argbash
argbash copied to clipboard
Use parameter expansion for default variable initialization
Currently argument variables are initialized like this:
# THE DEFAULTS INITIALIZATION - OPTIONALS
_arg_print=off
_arg_foo_option="boo"
This is problematic when using sub-parsers, as optionals that were already parsed by the main script are reset to it's defaults and not parsed again. Could parameter expansion be used instead?
# THE DEFAULTS INITIALIZATION - OPTIONALS
_arg_print=${_arg_print:-off}
_arg_foo_option="${_arg_foo_option:-boo}"
You could actually try to specify ${_arg_print:-off}
as the default value.
Aside from that, I would like to support subparsers in a less "hacky" way, but I have to think about it somehow more.