From 850cabf4edfead4d610aa5760619ecfbf023fae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= Date: Sat, 1 Aug 2020 00:59:02 +0200 Subject: [PATCH] The 2.9.0 release. --- ChangeLog | 2 +- bin/argbash | 8 ++++---- bin/argbash-1to2 | 4 ++-- bin/argbash-init | 6 +++--- doc/_static/argbash-version.txt | 2 +- doc/_static/minimal.patch | 16 +++++++++------- doc/_static/wrapper-output-action.txt | 4 ++-- doc/install.rst | 2 +- resources/examples/minimal-raw.m4 | 6 +++++- resources/examples/minimal.m4 | 6 +++++- resources/examples/simple-parsing.sh | 9 ++++----- resources/examples/simple-wrapper.sh | 11 +++++------ resources/examples/simple.sh | 4 ++-- src/argbash-init.m4 | 2 +- src/version | 2 +- 15 files changed, 46 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a982cf..6909477 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2.9.0 (TBA) +2.9.0 (2020-08-01) ------------------ Buxfixes: diff --git a/bin/argbash b/bin/argbash index 46472a3..118c388 100755 --- a/bin/argbash +++ b/bin/argbash @@ -24,7 +24,7 @@ # ARGBASH_GO() # needed because of Argbash --> m4_ignore([ -### START OF CODE GENERATED BY Argbash v2.8.1 one line above ### +### START OF CODE GENERATED BY Argbash v2.9.0 one line above ### # Argbash is a bash code generator used to get arguments parsing right. # Argbash is FREE SOFTWARE, see https://argbash.io for more info @@ -201,11 +201,11 @@ parse_commandline() exit 0 ;; -v|--version) - printf '%s %s\n\n%s\n' "argbash" "2.8.1" 'Argbash is an argument parser generator for Bash.' + printf '%s %s\n\n%s\n' "argbash" "2.9.0" 'Argbash is an argument parser generator for Bash.' exit 0 ;; -v*) - printf '%s %s\n\n%s\n' "argbash" "2.8.1" 'Argbash is an argument parser generator for Bash.' + printf '%s %s\n\n%s\n' "argbash" "2.9.0" 'Argbash is an argument parser generator for Bash.' exit 0 ;; *) @@ -495,7 +495,7 @@ then # match against suspicious, then inverse match against correct stuff: # #\(allowed\|another allowed\|...\) end of line> # Then, extract all matches (assumed to be alnum chars + '_') from grep and put them in the error msg. - 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')" + 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_LOAD_LIBRARY\|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')" test -n "$grep_output" && die "Your script contains possible misspelled Argbash macros: $grep_output" 1 fi if test "$outfname" != '-' diff --git a/bin/argbash-1to2 b/bin/argbash-1to2 index d4829a4..de29e0e 100755 --- a/bin/argbash-1to2 +++ b/bin/argbash-1to2 @@ -3,7 +3,7 @@ # shellcheck disable=SC2016 # SC2016: Expressions don't expand in single quotes, use double quotes for that. -version=2.8.1 +version=2.9.0 # ARG_POSITIONAL_INF([input],[The input file to transform],[1]) # ARG_OPTIONAL_SINGLE([output],[o],[Name of the output file (pass '-' for stdout and empty string for the same as input file)],[""]) # ARG_VERSION([echo "argbash-1to2 v$version"]) @@ -11,7 +11,7 @@ version=2.8.1 # ARGBASH_GO() # needed because of Argbash --> m4_ignore([ -### START OF CODE GENERATED BY Argbash v2.8.1 one line above ### +### START OF CODE GENERATED BY Argbash v2.9.0 one line above ### # Argbash is a bash code generator used to get arguments parsing right. # Argbash is FREE SOFTWARE, see https://argbash.io for more info diff --git a/bin/argbash-init b/bin/argbash-init index 366a824..23707a2 100755 --- a/bin/argbash-init +++ b/bin/argbash-init @@ -4,7 +4,7 @@ # SC2001: See if you can use ${variable//search/replace} instead. # SC2016: Expressions don't expand in single quotes, use double quotes for that. -version=2.8.1 +version=2.9.0 # ARG_POSITIONAL_SINGLE([output],[Name of the output template],[-]) # ARG_OPTIONAL_INCREMENTAL([separate],[s],[Separate the parsing logic (specify two times for complete separation)]) # ARG_OPTIONAL_BOOLEAN([hints],[],[Whether to write hints to the script template]) @@ -19,7 +19,7 @@ version=2.8.1 # ARGBASH_GO() # needed because of Argbash --> m4_ignore([ -### START OF CODE GENERATED BY Argbash v2.8.1 one line above ### +### START OF CODE GENERATED BY Argbash v2.9.0 one line above ### # Argbash is a bash code generator used to get arguments parsing right. # Argbash is FREE SOFTWARE, see https://argbash.io for more info @@ -363,7 +363,7 @@ do_script_separate() do_body() { - echo "# vvv PLACE YOUR CODE GOES HERE vvv" + echo "# vvv PLACE YOUR CODE HERE vvv" if test "${#_variables[@]}" -gt 0; then echo "# For example:" for stat in "${_variables[@]}" diff --git a/doc/_static/argbash-version.txt b/doc/_static/argbash-version.txt index 4cc5ce9..a7ef22e 100644 --- a/doc/_static/argbash-version.txt +++ b/doc/_static/argbash-version.txt @@ -1,3 +1,3 @@ -argbash 2.8.1 +argbash 2.9.0 Argbash is an argument parser generator for Bash. diff --git a/doc/_static/minimal.patch b/doc/_static/minimal.patch index 0e3cab8..1d25fd3 100644 --- a/doc/_static/minimal.patch +++ b/doc/_static/minimal.patch @@ -1,18 +1,17 @@ ---- minimal-raw.m4 2017-12-06 23:51:13.985545630 +0100 -+++ minimal.m4 2017-12-06 23:54:30.169992192 +0100 -@@ -3,16 +3,22 @@ +--- minimal-raw.m4 2020-08-01 00:01:13.050519113 +0200 ++++ minimal.m4 2020-08-01 00:01:05.053955492 +0200 +@@ -3,20 +3,26 @@ # m4_ignore( echo "This is just a script template, not the script (yet) - pass it to 'argbash' to fix this." >&2 exit 11 #)Created by argbash-init v@VERSION@ -# ARG_OPTIONAL_SINGLE([option]) -# ARG_OPTIONAL_BOOLEAN([print]) -# ARG_POSITIONAL_SINGLE([positional-arg]) --# ARG_DEFAULTS_POS --# ARG_HELP([]) +# ARG_OPTIONAL_SINGLE([option], o, [A option with short and long flags and default], [boo]) +# ARG_OPTIONAL_BOOLEAN([print], , [A boolean option with long flag (and implicit default: off)]) +# ARG_POSITIONAL_SINGLE([positional-arg], [Positional arg description], ) -+# ARG_DEFAULTS_POS + # ARG_DEFAULTS_POS +-# ARG_HELP([]) +# ARG_HELP([This is a minimal demo of Argbash potential]) +# ARG_VERSION([echo $0 v0.1]) +# ARGBASH_SET_INDENT([ ]) @@ -20,6 +19,8 @@ # [ <-- needed because of Argbash + # vvv PLACE YOUR CODE HERE vvv + # For example: -printf 'Value of --%s: %s\n' 'option' "$_arg_option" -printf "'%s' is %s\\n" 'print' "$_arg_print" -printf "Value of '%s': %s\\n" 'positional-arg' "$_arg_positional_arg" @@ -31,4 +32,5 @@ + echo "Not telling anything, print not requested" +fi - # ] <-- needed because of Argbash + # ^^^ TERMINATE YOUR CODE BEFORE THE BOTTOM ARGBASH MARKER ^^^ + diff --git a/doc/_static/wrapper-output-action.txt b/doc/_static/wrapper-output-action.txt index f7766f6..b031c24 100644 --- a/doc/_static/wrapper-output-action.txt +++ b/doc/_static/wrapper-output-action.txt @@ -6,7 +6,7 @@ Contents of '../src' matching '*.m4': argbash-lib.m4: 0 kiB argbash.m4: 10 kiB argument_value_types.m4: 5 kiB - collectors.m4: 20 kiB + collectors.m4: 21 kiB constants.m4: 0 kiB default_settings.m4: 0 kiB docopt.m4: 3 kiB @@ -23,7 +23,7 @@ Contents of '../src' matching '*.m4': output-strip-none.m4: 0 kiB output-strip-user-content.m4: 0 kiB progs.m4: 2 kiB - stuff.m4: 46 kiB + stuff.m4: 47 kiB utilities.m4: 11 kiB value_validators.m4: 5 kiB Contents of '../resources/examples' matching '*.m4': diff --git a/doc/install.rst b/doc/install.rst index e733c9c..effaa63 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -35,7 +35,7 @@ If you want to use Argbash locally, you have to download the software package an * Supply ``INSTALL_COMPLETION=yes`` as an installation argument to install bash completion for ``argbash`` to ``$(SYSCONFDIR)/bash_completion.d``. The default ``SYSCONFDIR`` is ``/etc``, but you may override it in the same way as you can override the ``PREFIX`` variable. - * To be able to let Argbash :ref:`generate manpages `, :ref:`rst2man ` needs to be installed on your system. It's part of the Python package :ref:`docutils ` which can be installed on Debian/Ubuntu using ``sudo apt install python3-docutils``. + * To be able to let Argbash :ref:`generate manpages `, `rst2man `_ needs to be installed on your system. It's part of the Python package `docutils `_ which can be installed on Debian/Ubuntu using ``sudo apt install python3-docutils``. * Run some checks by executing: ``make check`` (still in the ``resources`` folder). You should get a message ``All is OK`` at the bottom. diff --git a/resources/examples/minimal-raw.m4 b/resources/examples/minimal-raw.m4 index 97b4483..d0987a6 100755 --- a/resources/examples/minimal-raw.m4 +++ b/resources/examples/minimal-raw.m4 @@ -2,7 +2,7 @@ # m4_ignore( echo "This is just a script template, not the script (yet) - pass it to 'argbash' to fix this." >&2 -exit 11 #)Created by argbash-init v2.8.1 +exit 11 #)Created by argbash-init v2.9.0 # ARG_OPTIONAL_SINGLE([option]) # ARG_OPTIONAL_BOOLEAN([print]) # ARG_POSITIONAL_SINGLE([positional-arg]) @@ -12,8 +12,12 @@ exit 11 #)Created by argbash-init v2.8.1 # [ <-- needed because of Argbash +# vvv PLACE YOUR CODE HERE vvv +# For example: printf 'Value of --%s: %s\n' 'option' "$_arg_option" printf "'%s' is %s\\n" 'print' "$_arg_print" printf "Value of '%s': %s\\n" 'positional-arg' "$_arg_positional_arg" +# ^^^ TERMINATE YOUR CODE BEFORE THE BOTTOM ARGBASH MARKER ^^^ + # ] <-- needed because of Argbash diff --git a/resources/examples/minimal.m4 b/resources/examples/minimal.m4 index 4f6164b..abc8b85 100644 --- a/resources/examples/minimal.m4 +++ b/resources/examples/minimal.m4 @@ -2,7 +2,7 @@ # m4_ignore( echo "This is just a script template, not the script (yet) - pass it to 'argbash' to fix this." >&2 -exit 11 #)Created by argbash-init v2.8.1 +exit 11 #)Created by argbash-init v2.9.0 # ARG_OPTIONAL_SINGLE([option], o, [A option with short and long flags and default], [boo]) # ARG_OPTIONAL_BOOLEAN([print], , [A boolean option with long flag (and implicit default: off)]) # ARG_POSITIONAL_SINGLE([positional-arg], [Positional arg description], ) @@ -14,6 +14,8 @@ exit 11 #)Created by argbash-init v2.8.1 # [ <-- needed because of Argbash +# vvv PLACE YOUR CODE HERE vvv +# For example: if [ "$_arg_print" = on ] then echo "Positional arg value: '$_arg_positional_arg'" @@ -22,4 +24,6 @@ else echo "Not telling anything, print not requested" fi +# ^^^ TERMINATE YOUR CODE BEFORE THE BOTTOM ARGBASH MARKER ^^^ + # ] <-- needed because of Argbash diff --git a/resources/examples/simple-parsing.sh b/resources/examples/simple-parsing.sh index 4c23274..6ff348d 100755 --- a/resources/examples/simple-parsing.sh +++ b/resources/examples/simple-parsing.sh @@ -8,18 +8,17 @@ # ARGBASH_SET_INDENT([ ]) # ARGBASH_GO() # needed because of Argbash --> m4_ignore([ -### START OF CODE GENERATED BY Argbash v2.8.1 one line above ### +### START OF CODE GENERATED BY Argbash v2.9.0 one line above ### # Argbash is a bash code generator used to get arguments parsing right. # Argbash is FREE SOFTWARE, see https://argbash.io for more info die() { - local _ret=$2 - test -n "$_ret" || _ret=1 - test "$_PRINT_HELP" = yes && print_help >&2 + local _ret="${2:-1}" + test "${_PRINT_HELP:-no}" = yes && print_help >&2 echo "$1" >&2 - exit ${_ret} + exit "${_ret}" } diff --git a/resources/examples/simple-wrapper.sh b/resources/examples/simple-wrapper.sh index 81692d7..7830813 100755 --- a/resources/examples/simple-wrapper.sh +++ b/resources/examples/simple-wrapper.sh @@ -1,6 +1,6 @@ #!/bin/bash -# DEFINE_SCRIPT_DIR()_DEFINE_SCRIPT_DIR([],[cd "$(dirname "${BASH_SOURCE[0]}")" && pwd]) +# DEFINE_SCRIPT_DIR() # ARG_POSITIONAL_INF([directory],[Directories to go through],[1]) # ARG_OPTIONAL_SINGLE([glob],[],[What files to match in the directory],[*]) # ARGBASH_WRAP([simple-parsing],[filename]) @@ -8,18 +8,17 @@ # ARGBASH_SET_INDENT([ ]) # ARGBASH_GO() # needed because of Argbash --> m4_ignore([ -### START OF CODE GENERATED BY Argbash v2.8.1 one line above ### +### START OF CODE GENERATED BY Argbash v2.9.0 one line above ### # Argbash is a bash code generator used to get arguments parsing right. # Argbash is FREE SOFTWARE, see https://argbash.io for more info die() { - local _ret=$2 - test -n "$_ret" || _ret=1 - test "$_PRINT_HELP" = yes && print_help >&2 + local _ret="${2:-1}" + test "${_PRINT_HELP:-no}" = yes && print_help >&2 echo "$1" >&2 - exit ${_ret} + exit "${_ret}" } diff --git a/resources/examples/simple.sh b/resources/examples/simple.sh index 80b8cb1..952148b 100755 --- a/resources/examples/simple.sh +++ b/resources/examples/simple.sh @@ -1,10 +1,10 @@ #!/bin/bash -# DEFINE_SCRIPT_DIR([])_DEFINE_SCRIPT_DIR([],[cd "$(dirname "${BASH_SOURCE[0]}")" && pwd]) +# DEFINE_SCRIPT_DIR([]) # INCLUDE_PARSING_CODE([simple-parsing.sh]) # ARGBASH_GO() # needed because of Argbash --> m4_ignore([ -### START OF CODE GENERATED BY Argbash v2.8.1 one line above ### +### START OF CODE GENERATED BY Argbash v2.9.0 one line above ### # Argbash is a bash code generator used to get arguments parsing right. # Argbash is FREE SOFTWARE, see https://argbash.io for more info diff --git a/src/argbash-init.m4 b/src/argbash-init.m4 index 76c5eca..440d5b5 100644 --- a/src/argbash-init.m4 +++ b/src/argbash-init.m4 @@ -177,7 +177,7 @@ do_script_separate() do_body() { - echo "# vvv PLACE YOUR CODE GOES HERE vvv" + echo "# vvv PLACE YOUR CODE HERE vvv" if test "${#_variables[@]}" -gt 0; then echo "# For example:" for stat in "${_variables[@]}" diff --git a/src/version b/src/version index dbe5900..c8e38b6 100644 --- a/src/version +++ b/src/version @@ -1 +1 @@ -2.8.1 +2.9.0