addendum to #16

This commit is contained in:
Felix Lohmeier 2022-04-04 22:49:21 +02:00
parent 16b62a143e
commit 1af14125a5
1 changed files with 19 additions and 17 deletions

36
orcli
View File

@ -1,13 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script was generated by bashly 0.7.8 (https://bashly.dannyb.co) # This script was generated by bashly 0.7.9 (https://bashly.dannyb.co)
# Modifying it manually is not recommended # Modifying it manually is not recommended
# :script.bash3_bouncer # :wrapper.bash3_bouncer
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
printf "bash version 4 or higher is required\n" printf "bash version 4 or higher is required\n"
exit 1 exit 1
fi fi
# :command.master_script
# :command.version_command # :command.version_command
version_command() { version_command() {
echo "$version" echo "$version"
@ -185,16 +187,16 @@ inspect_args() {
} }
# :command.user_lib # :command.user_lib
# :src/lib/error.sh # src/lib/error.sh
#!/usr/bin/env bash
# log error message to STDERR # log error message to STDERR
# shellcheck shell=bash
function error() { function error() {
echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')]: ERROR $*" echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')]: ERROR $*"
} }
# :src/lib/get_csrf.sh # src/lib/get_csrf.sh
#!/usr/bin/env bash
# get CSRF token (introduced in OpenRefine 3.3) # get CSRF token (introduced in OpenRefine 3.3)
# shellcheck shell=bash
function get_csrf() { function get_csrf() {
if [[ "${OPENREFINE_CSRF}" == true ]]; then if [[ "${OPENREFINE_CSRF}" == true ]]; then
local response local response
@ -207,9 +209,9 @@ function get_csrf() {
fi fi
} }
# :src/lib/get_id.sh # src/lib/get_id.sh
#!/usr/bin/env bash
# get project id (derived from project name if needed) # get project id (derived from project name if needed)
# shellcheck shell=bash disable=SC2154
function get_id() { function get_id() {
local response local response
local projects local projects
@ -234,16 +236,16 @@ function get_id() {
# :command.command_functions # :command.command_functions
# :command.function # :command.function
orcli_info_command() { orcli_info_command() {
# :src/info_command.sh # src/info_command.sh
#!/usr/bin/env bash # shellcheck shell=bash
get_id get_id
} }
# :command.function # :command.function
orcli_list_command() { orcli_list_command() {
# :src/list_command.sh # src/list_command.sh
#!/usr/bin/env bash
# get all project metadata and reshape json to print a list # get all project metadata and reshape json to print a list
# shellcheck shell=bash
if ! response="$(curl -fs --get "${OPENREFINE_URL}/command/core/get-all-project-metadata")"; then if ! response="$(curl -fs --get "${OPENREFINE_URL}/command/core/get-all-project-metadata")"; then
error "no OpenRefine reachable/running at ${OPENREFINE_URL}" error "no OpenRefine reachable/running at ${OPENREFINE_URL}"
else else
@ -253,7 +255,7 @@ orcli_list_command() {
# :command.parse_requirements # :command.parse_requirements
parse_requirements() { parse_requirements() {
# :command.fixed_flag_filter # :command.fixed_flags_filter
case "${1:-}" in case "${1:-}" in
--version | -v ) --version | -v )
version_command version_command
@ -335,7 +337,7 @@ parse_requirements() {
# :command.parse_requirements # :command.parse_requirements
orcli_info_parse_requirements() { orcli_info_parse_requirements() {
# :command.fixed_flag_filter # :command.fixed_flags_filter
case "${1:-}" in case "${1:-}" in
--help | -h ) --help | -h )
long_usage=yes long_usage=yes
@ -386,7 +388,7 @@ orcli_info_parse_requirements() {
# :command.parse_requirements # :command.parse_requirements
orcli_list_parse_requirements() { orcli_list_parse_requirements() {
# :command.fixed_flag_filter # :command.fixed_flags_filter
case "${1:-}" in case "${1:-}" in
--help | -h ) --help | -h )
long_usage=yes long_usage=yes
@ -431,8 +433,8 @@ initialize() {
long_usage='' long_usage=''
set -e set -e
# :src/initialize.sh # src/initialize.sh
#!/usr/bin/env bash # shellcheck shell=bash
} }
# :command.run # :command.run