Using RQ to change toml and yaml to JSON, removing all python stuff

This commit is contained in:
Omar Ahmad
2020-12-21 19:19:52 -05:00
parent b9bbeacae1
commit 18e9954d74
4 changed files with 57 additions and 5 deletions

View File

@ -17,11 +17,11 @@ fi
get_config() {
if [ -f "${HOME_DIR}/config.toml" ]; then
python3 -c "with open('${HOME_DIR}/config.toml') as ct, open('${HOME_DIR}/config.json', 'w') as cj: import toml; import json; json.dump(list(toml.load(ct).values()), cj)"
rq -t <<< $(cat ${HOME_DIR}/config.toml) | jq 'map(.)' > ${HOME_DIR}/config.json
elif [ -f "${HOME_DIR}/config.yml" ]; then
python3 -c "with open('${HOME_DIR}/config.yml') as cy, open('${HOME_DIR}/config.json', 'w') as cj: import yaml; import json; json.dump(list(yaml.safe_load(cy).values()), cj)"
rq -y <<< $(cat ${HOME_DIR}/config.yml) | jq 'map(.)' > ${HOME_DIR}/config.json
elif [ -f "${HOME_DIR}/config.yaml" ]; then
python3 -c "with open('${HOME_DIR}/config.yaml') as cy, open('${HOME_DIR}/config.json', 'w') as cj: import yaml; import json; json.dump(list(yaml.safe_load(cy).values()), cj)"
rq -y <<< $(cat ${HOME_DIR}/config.yaml) | jq 'map(.)' > ${HOME_DIR}/config.json
fi
}