diff --git a/AUTHORS b/AUTHORS index 012feca..c5448df 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,3 +5,4 @@ Kevin Stravers Matěj Týč Nicola Lunghi Stephen Gallagher +Hannes Leutloff diff --git a/bin/argbash b/bin/argbash index 4e344b9..66cbefa 100755 --- a/bin/argbash +++ b/bin/argbash @@ -86,7 +86,7 @@ _arg_debug= print_help() { printf '%s\n' "Argbash is an argument parser generator for Bash." - printf 'Usage: %s [-o|--output ] [-i|--(no-)in-place] [-t|--type ] [--(no-)library] [--strip ] [--(no-)check-typos] [-c|--(no-)commented] [-I|--search ] [--debug ] [-h|--help] [-v|--version] \n' "$0" + printf 'Usage: %s [-o|--output ] [-i|--(no-)in-place] [-t|--type ] [--(no-)library] [--strip ] [--(no-)check-typos] [-c|--(no-)commented] [-I|--search ] [--debug ] [-h|--help] [-v|--version] \n' "$(basename "$0")" printf '\t%s\n' ": The input template file (pass '-' for stdin)" printf '\t%s\n' "-o, --output: Name of the output file (pass '-' for stdout) (default: '-')" printf '\t%s\n' "-i, --in-place, --no-in-place: Update a bash script in-place (off by default)" diff --git a/bin/argbash-1to2 b/bin/argbash-1to2 index 98fba43..91e532b 100755 --- a/bin/argbash-1to2 +++ b/bin/argbash-1to2 @@ -42,7 +42,7 @@ _arg_output="" print_help() { printf '%s\n' "Convert a template for argbash>=1,<2 to argbash>=2,<3" - printf 'Usage: %s [-o|--output ] [-v|--version] [-h|--help] [] ... [] ...\n' "$0" + printf 'Usage: %s [-o|--output ] [-v|--version] [-h|--help] [] ... [] ...\n' "$(basename "$0")" printf '\t%s\n' ": The input file to transform" printf '\t%s\n' "-o, --output: Name of the output file (pass '-' for stdout and empty string for the same as input file) (default: '""')" printf '\t%s\n' "-v, --version: Prints version" diff --git a/bin/argbash-init b/bin/argbash-init index 8294208..2966d77 100755 --- a/bin/argbash-init +++ b/bin/argbash-init @@ -66,7 +66,7 @@ _arg_mode="default" print_help() { printf '%s\n' "Make a template for scripts." - printf 'Usage: %s [-s|--separate] [--(no-)hints] [--pos ] [--opt ] [--opt-bool ] [-m|--mode ] [-v|--version] [-h|--help] []\n' "$0" + printf 'Usage: %s [-s|--separate] [--(no-)hints] [--pos ] [--opt ] [--opt-bool ] [-m|--mode ] [-v|--version] [-h|--help] []\n' "$(basename "$0")" printf '\t%s\n' ": Name of the output template (default: '-')" printf '\t%s\n' "-s, --separate: Separate the parsing logic (specify two times for complete separation)" printf '\t%s\n' "--hints, --no-hints: Whether to write hints to the script template (off by default)" diff --git a/src/stuff.m4 b/src/stuff.m4 index 68dbc0c..e47b614 100644 --- a/src/stuff.m4 +++ b/src/stuff.m4 @@ -417,7 +417,7 @@ m4_define([_MAKE_HELP], [MAKE_FUNCTION( [dnl If we have optionals, display them like [--opt1 arg] [--(no-)opt2] ... according to their type. @<:@ becomes square bracket at the end of processing ], [_MAKE_HELP_SYNOPSIS([$1])], - [\n' "@S|@0"_ENDL_()], + [\n' "$(basename "@S|@0")"_ENDL_()], [_IF_HAVE_POSITIONAL_ARGS([_MAKE_HELP_FUNCTION_POSITIONAL_PART])], [dnl If we have 0 optional args, don't do anything (FOR loop would assert, 0 < 1) ], diff --git a/tests/regressiontests/Makefile b/tests/regressiontests/Makefile index a640d53..e30db7a 100644 --- a/tests/regressiontests/Makefile +++ b/tests/regressiontests/Makefile @@ -266,6 +266,7 @@ basic: $(TESTDIR)/basic.sh grep -q "local _key$$" $< $< -h | grep -q 'P percent: %' $< -h | grep -q 'O percent: %' + $< -h | grep -q 'Usage: $(notdir $<) ' ! $< -h | grep -qe '\[--\]' test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/basic.sh" basic-dash: $(TESTDIR)/basic-dash.sh @@ -275,6 +276,7 @@ basic-dash: $(TESTDIR)/basic-dash.sh $< LOO -b | grep -q BOOL=off, $< -h | grep -q 'P percent: %' $< -h | grep -q 'O percent: %' + $< -h | grep -q 'Usage: $(notdir $<) ' $< -h | grep -qe '\[--\]' test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/basic-dash.sh" test-void: $(TESTDIR)/test-void.sh diff --git a/tests/regressiontests/make/tests/tests-base.m4 b/tests/regressiontests/make/tests/tests-base.m4 index a5c00b2..26e34d7 100644 --- a/tests/regressiontests/make/tests/tests-base.m4 +++ b/tests/regressiontests/make/tests/tests-base.m4 @@ -9,6 +9,7 @@ ADD_TEST_BASH([basic], [[ grep -q "local _key$$" $< $< -h | grep -q 'P percent: %' $< -h | grep -q 'O percent: %' + $< -h | grep -q 'Usage: $(notdir $<) ' ! $< -h | grep -qe '\[--\]' ]]) @@ -20,6 +21,7 @@ ADD_TEST_DASH([basic], [[ $< LOO -b | grep -q BOOL=off, $< -h | grep -q 'P percent: %' $< -h | grep -q 'O percent: %' + $< -h | grep -q 'Usage: $(notdir $<) ' $< -h | grep -qe '\[--\]' ]])