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