From 18c937611f09a932b1418dc3d1556579132cb7ec Mon Sep 17 00:00:00 2001 From: ilguappo Date: Wed, 23 Jul 2025 17:14:01 -0700 Subject: [PATCH] fix: call_api now takes arguments correctly. --- mc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mc b/mc index ad34d56..bb69eda 100755 --- a/mc +++ b/mc @@ -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")