From 22c537aa9b7efbffb585168b6d58d33dc7c57c59 Mon Sep 17 00:00:00 2001 From: felixlohmeier Date: Tue, 6 Dec 2022 16:08:43 +0000 Subject: [PATCH] elaborate info command --- orcli | 10 +++++++++- src/info_command.sh | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/orcli b/orcli index cf6b837..9273e1d 100755 --- a/orcli +++ b/orcli @@ -1121,9 +1121,17 @@ orcli_list_command() { orcli_info_command() { # src/info_command.sh # shellcheck shell=bash disable=SC2154 + # get project id projectid="$(get_id "${args[project]}")" - echo "$projectid" + + if ! response="$(curl -fs --get --data "project=${projectid}" "${OPENREFINE_URL}/command/core/get-project-metadata")"; then + error "reading metadata of ${args[project]} failed!" + else + columns="$(curl -fs --get --data "project=${projectid}" "${OPENREFINE_URL}/command/core/get-models" | jq '[ .columnModel | .columns[] | .name ]')" + jq "{ id: ${projectid} } + . + {columns: $columns }" <<<"$response" + fi + } # :command.function diff --git a/src/info_command.sh b/src/info_command.sh index bb89eee..8cdf727 100644 --- a/src/info_command.sh +++ b/src/info_command.sh @@ -1,4 +1,11 @@ # shellcheck shell=bash disable=SC2154 + # get project id projectid="$(get_id "${args[project]}")" -echo "$projectid" \ No newline at end of file + +if ! response="$(curl -fs --get --data "project=${projectid}" "${OPENREFINE_URL}/command/core/get-project-metadata")"; then + error "reading metadata of ${args[project]} failed!" +else + columns="$(curl -fs --get --data "project=${projectid}" "${OPENREFINE_URL}/command/core/get-models" | jq '[ .columnModel | .columns[] | .name ]')" + jq "{ id: ${projectid} } + . + {columns: $columns }" <<<"$response" +fi