Skip to content

Commit d555922

Browse files
committed
Half-way through.
1 parent 4043011 commit d555922

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

bin/argbash

+1-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ then
495495
# match against suspicious, then inverse match against correct stuff:
496496
# #<optional whitespace>\(allowed\|another allowed\|...\)<optional whitespace><opening bracket <or> end of line>
497497
# Then, extract all matches (assumed to be alnum chars + '_') from grep and put them in the error msg.
498-
grep_output="$(printf "%s" "$output" | grep '^#\s*\(ARG_\|ARGBASH\)' | grep -v '^#\s*\(ARGBASH_SET_INDENT\|ARG_OPTIONAL_SINGLE\|ARG_VERSION\|ARG_VERSION_AUTO\|ARG_HELP\|ARG_OPTIONAL_INCREMENTAL\|ARG_OPTIONAL_REPEATED\|ARG_VERBOSE\|ARG_OPTIONAL_BOOLEAN\|ARG_OPTIONAL_ACTION\|ARG_POSITIONAL_SINGLE\|ARG_POSITIONAL_INF\|ARG_POSITIONAL_MULTI\|ARG_POSITIONAL_DOUBLEDASH\|ARG_OPTION_STACKING\|ARG_RESTRICT_VALUES\|ARG_DEFAULTS_POS\|ARG_LEFTOVERS\|ARGBASH_WRAP\|INCLUDE_PARSING_CODE\|DEFINE_SCRIPT_DIR\|DEFINE_SCRIPT_DIR_GNU\|ARGBASH_SET_DELIM\|ARGBASH_GO\|ARGBASH_PREPARE\|ARG_TYPE_GROUP\|ARG_TYPE_GROUP_SET\|ARG_USE_ENV\|ARG_USE_PROG\)\s*\((\|$\)' | sed -e 's/#\s*\([[:alnum:]_]*\).*/\1 /' | tr -d '\n\r')"
498+
grep_output="$(printf "%s" "$output" | grep '^#\s*\(ARG_\|ARGBASH\)' | grep -v '^#\s*\(ARGBASH_SET_INDENT\|ARG_OPTIONAL_SINGLE\|ARG_VERSION\|ARG_VERSION_AUTO\|ARG_HELP\|ARG_OPTIONAL_INCREMENTAL\|ARG_OPTIONAL_REPEATED\|ARG_VERBOSE\|ARG_OPTIONAL_BOOLEAN\|ARG_OPTIONAL_SWITCH_ON\|ARG_OPTIONAL_SWITCH_OFF\|ARG_OPTIONAL_ACTION\|ARG_POSITIONAL_SINGLE\|ARG_POSITIONAL_INF\|ARG_POSITIONAL_MULTI\|ARG_POSITIONAL_DOUBLEDASH\|ARG_OPTION_STACKING\|ARG_RESTRICT_VALUES\|ARG_DEFAULTS_POS\|ARG_LEFTOVERS\|ARGBASH_WRAP\|INCLUDE_PARSING_CODE\|DEFINE_SCRIPT_DIR\|DEFINE_SCRIPT_DIR_GNU\|ARGBASH_SET_DELIM\|ARGBASH_GO\|ARGBASH_PREPARE\|ARG_TYPE_GROUP\|ARG_TYPE_GROUP_SET\|ARG_USE_ENV\|ARG_USE_PROG\)\s*\((\|$\)' | sed -e 's/#\s*\([[:alnum:]_]*\).*/\1 /' | tr -d '\n\r')"
499499
test -n "$grep_output" && die "Your script contains possible misspelled Argbash macros: $grep_output" 1
500500
fi
501501
if test "$outfname" != '-'

src/collectors.m4

+8-6
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,14 @@ dnl $3: help
348348
dnl $4: default (=off)
349349
argbash_api([ARG_OPTIONAL_BOOLEAN], _CHECK_PASSED_ARGS_COUNT(1, 4)[m4_do(
350350
[[$0($@)]],
351-
[m4_ifnblank([$4], [m4_case([$4],
352-
[on], [_ARG_OPTIONAL_SWITCH_ON([$1], [$2], [$3])],
353-
[off], [_ARG_OPTIONAL_SWITCH_OFF([$1], [$2], [$3])],
354-
[_COLLECTOR_FEEDBACK([Problem with argument '$1': Only 'on' or 'off' are allowed as boolean defaults, you have specified '$4'.])])])],
355-
[_ADD_OPTIONAL_ARGUMENT_IF_POSSIBLE([$1], [$2], [$3],
356-
m4_default_quoted([$4], [off]), [bool])],
351+
[m4_ifnblank([$4],
352+
[m4_case([$4],
353+
[off], [_ARG_OPTIONAL_SWITCH_ON([$1], [$2], [$3])],
354+
[on], [_ARG_OPTIONAL_SWITCH_OFF([$1], [$2], [$3])],
355+
[_COLLECTOR_FEEDBACK([Problem with argument '$1': Only 'on' or 'off' are allowed as boolean defaults, you have specified '$4'.])])],
356+
[_ADD_OPTIONAL_ARGUMENT_IF_POSSIBLE([$1], [$2], [$3],
357+
m4_default_quoted([$4], [off]), [bool])],
358+
)],
357359
)])
358360

359361

tests/regressiontests/test-onlyopt.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
m4_define([if_not_posix], [m4_if(m4_quote(_OUTPUT_TYPE), [posix-script], [$2], [$1])])
44

55
dnl m4_define([test], [m4_fatal([BOOM!!!])])
6-
m4_define([incrx], [m4_fatal([BOOM!!!])])
6+
m4_define([incrx], [m4_ftal([BOOM!!!])])
77
# ARG_OPTIONAL_SINGLE([opt-arg], o, [@opt-arg@], x)
88
# ARG_VERSION([echo "$0 FOO"])
99
# ARG_OPTIONAL_BOOLEAN(boo_l, B)

0 commit comments

Comments
 (0)