lexonomy_custom_editor/build/download_structure_conversions.sh

20 lines
504 B
Bash
Executable File

#!/bin/bash
# fail if any command fails
set -e
if [[ -z "${API_KEY}" ]]; then
echo "API_KEY not defined, should be api key to CJVT's gitea"
exit 1
fi
OUT_FILE=conversions.csv
rm -f $OUT_FILE
for fname in glagol pridevnik prislov samostalnik; do
curl -s "https://gitea.cjvt.si/api/v1/repos/redmine_projects/kolokacije/contents/resources/structure_conversions/$fname.csv?token=$API_KEY" |
python3 -c "import sys, json; print(json.load(sys.stdin)['content'])" | base64 -d >> $OUT_FILE
done