fix: call_api now takes arguments correctly.

This commit is contained in:
2025-07-23 17:14:01 -07:00
parent 0c8a3672ac
commit 18c937611f

8
mc
View File

@@ -137,18 +137,20 @@ function usage() {
}
function call_api() {
local command="$1"
local args=("${@}")
# 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
if [[ ! -v commands[$1] ]]; then
if [[ ! -v commands[$command] ]]; then
printf "${0}: invalid option -- $1\n\n"
usage
exit 1
fi
local endpoint method body description
read -r endpoint method body description <<<"${commands[$1]}"
read -r endpoint method body description <<<"${commands[$command]}"
case "${method}" in
"POST")