Closed kamalmarhubi closed 5 years ago
Looks great, thank you for your contribution!
Quick question as I'm completely unfamiliar with m4: is @S|@
standard for $
? It took me quite a while to understand that this was an escape for $
and not some other construct.
Yes, argbash is using an extension of m4
called m4sugar
. It is documented in the autoconf manual: https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Quadrigraphs.html
I like to keep
set -euo pipefail
at the top of my scripts. This causes a couple of errors with argbash's die function reading unset variables:it sets a default for the exit code like in a way that unconditionally reads the second argument
local _ret=$2 # <---- can fail if only one arg passed in test -n "$_ret" || _ret=1
it reads unconditionally from _PRINT_HELP, which may not be set
This commit changes both of these to use default values in parameter expansion. This construct is part of POSIX, and so should work in both bash and posix mode.
Additionally fix a shellcheck quote warning.
Tested: Verified the generated die function works with nounset.