orcli/src/list_command.sh

12 lines
463 B
Bash
Raw Normal View History

2022-03-25 11:16:02 +01:00
# get all project metadata and reshape json to print a list
2022-04-04 22:36:03 +02:00
# shellcheck shell=bash
2022-03-25 23:02:28 +01:00
if ! response="$(curl -fs --get "${OPENREFINE_URL}/command/core/get-all-project-metadata")"; then
2022-03-25 11:16:02 +01:00
error "no OpenRefine reachable/running at ${OPENREFINE_URL}"
else
2022-04-12 18:26:43 +02:00
if [[ "${response}" == '{"projects":{}}' ]]; then
2022-04-20 12:27:53 +02:00
log "${OPENREFINE_URL} does not contain any projects yet."
2022-04-12 18:26:43 +02:00
else
echo "$response" | jq -r '.projects | keys[] as $k | "\($k):\(.[$k] | .name)"'
fi
2022-03-25 11:16:02 +01:00
fi