cmdarg_info so it checks for anything NOT in flags

The cmdarg_info function should check whether the input is NOT in flags rather than the other way around. Otherwise it will fail every time when doing one is actually doing the right thing.
This commit is contained in:
John Axel Eriksson
2014-08-12 14:48:08 +02:00
parent aede1cefbe
commit 5c2fbc5110

View File

@@ -102,7 +102,7 @@ function cmdarg_info
# Sets various flags about your script that are printed during cmdarg_usage # Sets various flags about your script that are printed during cmdarg_usage
# #
local flags="header|copyright|footer|author" local flags="header|copyright|footer|author"
if [[ "$1" =~ $flags ]]; then if [[ ! "$1" =~ $flags ]]; then
echo "cmdarg_info <flag> <value>" >&2 echo "cmdarg_info <flag> <value>" >&2
echo "Where <flag> is one of $flags" >&2 echo "Where <flag> is one of $flags" >&2
${CMDARG_ERROR_BEHAVIOR} 1 ${CMDARG_ERROR_BEHAVIOR} 1