-
-
Notifications
You must be signed in to change notification settings - Fork 63
Description
I'm using Argbash v2.11.0 to generate argument parsing code for a bash script. When I regenerate the script using the argbash template, it consistently changes this line:
In the template (working syntax):
# Command routing
case "$_arg_command" in
# ... other cases ...
"image_processor") cmd_run_image_processor "${_arg_leftovers[@]}" ;;
# ... other cases ...
esacAfter template application in the artifact (broken):
# Command routing
case "$_arg_command" in
# ... other cases ...
"image_processor") cmd_run_image_processor "${_arg_leftovers@}" ;;
# ... other cases ...
esacThe template removes the [@] and leaves only @, which breaks the script.
More context:
My argbash template configuration:
# ARG_POSITIONAL_SINGLE([command])
# ARG_LEFTOVERS([args])
# ARG_DEFAULTS_POS([])The _arg_leftovers array contains all arguments after the command. The function being called expects these arguments:
cmd_run_image_processor() {
local input_path="$1"
local args=("${@:2}")
# ... path processing ...
(cd image_processor && uv run python -m image_processor.cli "$input_path" "${args[@]}")
}I need "${_arg_leftovers[@]}" to pass all the leftover arguments as separate parameters to the function so it can properly handle commands like:
script_runner.sh image_processor images/ --output processed/ --task resize --format webpWhen the template changes it to "${_arg_leftovers@}", the array expansion fails and arguments aren't passed correctly to the function, breaking the image processor commands.