shfmt and shebang
This commit is contained in:
parent
5d1cd632bd
commit
5b2df6fea0
19
orcli
19
orcli
|
@ -186,14 +186,16 @@ inspect_args() {
|
|||
|
||||
# :command.user_lib
|
||||
# :src/lib/error.sh
|
||||
#!/usr/bin/env bash
|
||||
# log error message to STDERR
|
||||
function error {
|
||||
function error() {
|
||||
echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')]: ERROR $*"
|
||||
}
|
||||
|
||||
# :src/lib/get_csrf.sh
|
||||
#!/usr/bin/env bash
|
||||
# get CSRF token (introduced in OpenRefine 3.3)
|
||||
function get_csrf {
|
||||
function get_csrf() {
|
||||
if [[ "${OPENREFINE_CSRF}" == true ]]; then
|
||||
local response
|
||||
response=$(curl -fs "${OPENREFINE_URL}/command/core/get-csrf-token")
|
||||
|
@ -206,8 +208,9 @@ fi
|
|||
}
|
||||
|
||||
# :src/lib/get_id.sh
|
||||
#!/usr/bin/env bash
|
||||
# get project id (derived from project name if needed)
|
||||
function get_id {
|
||||
function get_id() {
|
||||
local response
|
||||
local projects
|
||||
local ids
|
||||
|
@ -232,19 +235,16 @@ echo "$ids"
|
|||
# :command.function
|
||||
orcli_info_command() {
|
||||
# :src/info_command.sh
|
||||
echo "# this file is located in 'src/info_command.sh'"
|
||||
echo "# code for 'openrefine-cli.sh info' goes here"
|
||||
echo "# you can edit it freely and regenerate (it will not be overwritten)"
|
||||
inspect_args
|
||||
#!/usr/bin/env bash
|
||||
get_id
|
||||
}
|
||||
|
||||
# :command.function
|
||||
orcli_list_command() {
|
||||
# :src/list_command.sh
|
||||
#!/usr/bin/env bash
|
||||
# get all project metadata and reshape json to print a list
|
||||
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}"
|
||||
else
|
||||
echo "$response" | jq -r '.projects | keys[] as $k | "\($k):\(.[$k] | .name)"'
|
||||
|
@ -432,6 +432,7 @@ initialize() {
|
|||
set -e
|
||||
|
||||
# :src/initialize.sh
|
||||
#!/usr/bin/env bash
|
||||
}
|
||||
|
||||
# :command.run
|
||||
|
|
|
@ -20,7 +20,6 @@ examples:
|
|||
- orcli info 1234567890123
|
||||
|
||||
commands:
|
||||
|
||||
- name: info
|
||||
help: show project metadata
|
||||
args:
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
echo "# this file is located in 'src/info_command.sh'"
|
||||
echo "# code for 'openrefine-cli.sh info' goes here"
|
||||
echo "# you can edit it freely and regenerate (it will not be overwritten)"
|
||||
inspect_args
|
||||
#!/usr/bin/env bash
|
||||
get_id
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
## Code here runs inside the initialize() function
|
||||
## Use it for anything that you need to run before any other function, like
|
||||
## setting environment vairables:
|
||||
## CONFIG_FILE=settings.ini
|
||||
##
|
||||
## Feel free to empty (but not delete) this file.
|
||||
## Use it for anything that you need to run before any other function
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# log error message to STDERR
|
||||
function error {
|
||||
function error() {
|
||||
echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')]: ERROR $*"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# get CSRF token (introduced in OpenRefine 3.3)
|
||||
function get_csrf {
|
||||
function get_csrf() {
|
||||
if [[ "${OPENREFINE_CSRF}" == true ]]; then
|
||||
local response
|
||||
response=$(curl -fs "${OPENREFINE_URL}/command/core/get-csrf-token")
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# get project id (derived from project name if needed)
|
||||
function get_id {
|
||||
function get_id() {
|
||||
local response
|
||||
local projects
|
||||
local ids
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# get all project metadata and reshape json to print a list
|
||||
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}"
|
||||
else
|
||||
echo "$response" | jq -r '.projects | keys[] as $k | "\($k):\(.[$k] | .name)"'
|
||||
|
|
Loading…
Reference in New Issue