fix: call_api now takes arguments correctly.
This commit is contained in:
8
mc
8
mc
@@ -137,18 +137,20 @@ function usage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function call_api() {
|
function call_api() {
|
||||||
|
local command="$1"
|
||||||
|
local args=("${@}")
|
||||||
# remove command from arg list while preserving quoted strings.
|
# remove command from arg list while preserving quoted strings.
|
||||||
local args=("${ARGS[@]:1}")
|
local args=("${args[@]:1}")
|
||||||
|
|
||||||
# Check if key does NOT exists in command array
|
# Check if key does NOT exists in command array
|
||||||
if [[ ! -v commands[$1] ]]; then
|
if [[ ! -v commands[$command] ]]; then
|
||||||
printf "${0}: invalid option -- $1\n\n"
|
printf "${0}: invalid option -- $1\n\n"
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local endpoint method body description
|
local endpoint method body description
|
||||||
read -r endpoint method body description <<<"${commands[$1]}"
|
read -r endpoint method body description <<<"${commands[$command]}"
|
||||||
|
|
||||||
case "${method}" in
|
case "${method}" in
|
||||||
"POST")
|
"POST")
|
||||||
|
Reference in New Issue
Block a user