"Fossies" - the Fresh Open Source Software Archive

Member "argbash-2.10.0/bin/argbash" (22 Sep 2020, 18930 Bytes) of package /linux/privat/argbash-2.10.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "argbash": 2.9.0_vs_2.10.0.

    1 #!/bin/bash
    2 
    3 # shellcheck disable=SC2016,SC2059
    4 # SC2016: Expressions don't expand in single quotes, use double quotes for that.
    5 # SC2059 Don't use variables in the printf format string.
    6 
    7 
    8 # DEFINE_SCRIPT_DIR()
    9 # ARG_POSITIONAL_SINGLE([input],[The input template file (pass '-' for stdin)])
   10 # ARG_OPTIONAL_SINGLE([output],[o],[Name of the output file (pass '-' for stdout)],[-])
   11 # ARG_OPTIONAL_BOOLEAN([in-place],[i],[Update a bash script in-place],[off])
   12 # ARG_OPTIONAL_SINGLE([type],[t],[Output type to generate],[bash-script])
   13 # ARG_OPTIONAL_BOOLEAN([library],[],[Whether the input file if the pure parsing library])
   14 # ARG_OPTIONAL_SINGLE([strip],[],[Determines what to have in the output],[none])
   15 # ARG_OPTIONAL_BOOLEAN([check-typos],[],[Whether to check for possible argbash macro typos],[on])
   16 # ARG_OPTIONAL_BOOLEAN([commented],[c],[Commented mode - include explanatory comments with the parsing code],[off])
   17 # ARG_OPTIONAL_REPEATED([search],[I],[Directories to search for the wrapped scripts (directory of the template will be added to the end of the list)],["."])
   18 # ARG_OPTIONAL_SINGLE([debug],[],[(developer option) Tell autom4te to trace a macro])
   19 # ARG_TYPE_GROUP_SET([content],[content],[strip],[none,user-content,all])
   20 # ARG_TYPE_GROUP_SET([type],[type],[type],[bash-script,posix-script,manpage,manpage-defs,completion,docopt])
   21 # ARG_DEFAULTS_POS([])
   22 # ARG_HELP([Argbash is an argument parser generator for Bash.])
   23 # ARG_VERSION_AUTO([_ARGBASH_VERSION])
   24 
   25 # ARGBASH_GO()
   26 # needed because of Argbash --> m4_ignore([
   27 ### START OF CODE GENERATED BY Argbash v2.10.0 one line above ###
   28 # Argbash is a bash code generator used to get arguments parsing right.
   29 # Argbash is FREE SOFTWARE, see https://argbash.io for more info
   30 
   31 
   32 die()
   33 {
   34     local _ret="${2:-1}"
   35     test "${_PRINT_HELP:-no}" = yes && print_help >&2
   36     echo "$1" >&2
   37     exit "${_ret}"
   38 }
   39 
   40 # validators
   41 
   42 content()
   43 {
   44     local _allowed=("none" "user-content" "all") _seeking="$1"
   45     for element in "${_allowed[@]}"
   46     do
   47         test "$element" = "$_seeking" && echo "$element" && return 0
   48     done
   49     die "Value '$_seeking' (of argument '$2') doesn't match the list of allowed values: 'none', 'user-content' and 'all'" 4
   50 }
   51 
   52 
   53 type()
   54 {
   55     local _allowed=("bash-script" "posix-script" "manpage" "manpage-defs" "completion" "docopt") _seeking="$1"
   56     for element in "${_allowed[@]}"
   57     do
   58         test "$element" = "$_seeking" && echo "$element" && return 0
   59     done
   60     die "Value '$_seeking' (of argument '$2') doesn't match the list of allowed values: 'bash-script', 'posix-script', 'manpage', 'manpage-defs', 'completion' and 'docopt'" 4
   61 }
   62 
   63 
   64 begins_with_short_option()
   65 {
   66     local first_option all_short_options='oitcIhv'
   67     first_option="${1:0:1}"
   68     test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0
   69 }
   70 
   71 # THE DEFAULTS INITIALIZATION - POSITIONALS
   72 _positionals=()
   73 _arg_input=
   74 # THE DEFAULTS INITIALIZATION - OPTIONALS
   75 _arg_output="-"
   76 _arg_in_place="off"
   77 _arg_type="bash-script"
   78 _arg_library="off"
   79 _arg_strip="none"
   80 _arg_check_typos="on"
   81 _arg_commented="off"
   82 _arg_search=(".")
   83 _arg_debug=
   84 
   85 
   86 print_help()
   87 {
   88     printf '%s\n' "Argbash is an argument parser generator for Bash."
   89     printf 'Usage: %s [-o|--output <arg>] [-i|--(no-)in-place] [-t|--type <type>] [--(no-)library] [--strip <content>] [--(no-)check-typos] [-c|--(no-)commented] [-I|--search <arg>] [--debug <arg>] [-h|--help] [-v|--version] <input>\n' "$0"
   90     printf '\t%s\n' "<input>: The input template file (pass '-' for stdin)"
   91     printf '\t%s\n' "-o, --output: Name of the output file (pass '-' for stdout) (default: '-')"
   92     printf '\t%s\n' "-i, --in-place, --no-in-place: Update a bash script in-place (off by default)"
   93     printf '\t%s\n' "-t, --type: Output type to generate. Can be one of: 'bash-script', 'posix-script', 'manpage', 'manpage-defs', 'completion' and 'docopt' (default: 'bash-script')"
   94     printf '\t%s\n' "--library, --no-library: Whether the input file if the pure parsing library (off by default)"
   95     printf '\t%s\n' "--strip: Determines what to have in the output. Can be one of: 'none', 'user-content' and 'all' (default: 'none')"
   96     printf '\t%s\n' "--check-typos, --no-check-typos: Whether to check for possible argbash macro typos (on by default)"
   97     printf '\t%s\n' "-c, --commented, --no-commented: Commented mode - include explanatory comments with the parsing code (off by default)"
   98     printf '\t%s' "-I, --search: Directories to search for the wrapped scripts (directory of the template will be added to the end of the list) (default array elements:"
   99     printf " '%s'" "."
  100     printf ')\n'
  101     printf '\t%s\n' "--debug: (developer option) Tell autom4te to trace a macro (no default)"
  102     printf '\t%s\n' "-h, --help: Prints help"
  103     printf '\t%s\n' "-v, --version: Prints version"
  104 }
  105 
  106 
  107 parse_commandline()
  108 {
  109     _positionals_count=0
  110     while test $# -gt 0
  111     do
  112         _key="$1"
  113         case "$_key" in
  114             -o|--output)
  115                 test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  116                 _arg_output="$2"
  117                 shift
  118                 ;;
  119             --output=*)
  120                 _arg_output="${_key##--output=}"
  121                 ;;
  122             -o*)
  123                 _arg_output="${_key##-o}"
  124                 ;;
  125             -i|--no-in-place|--in-place)
  126                 _arg_in_place="on"
  127                 test "${1:0:5}" = "--no-" && _arg_in_place="off"
  128                 ;;
  129             -i*)
  130                 _arg_in_place="on"
  131                 _next="${_key##-i}"
  132                 if test -n "$_next" -a "$_next" != "$_key"
  133                 then
  134                     { begins_with_short_option "$_next" && shift && set -- "-i" "-${_next}" "$@"; } || die "The short option '$_key' can't be decomposed to ${_key:0:2} and -${_key:2}, because ${_key:0:2} doesn't accept value and '-${_key:2:1}' doesn't correspond to a short option."
  135                 fi
  136                 ;;
  137             -t|--type)
  138                 test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  139                 _arg_type="$(type "$2" "type")" || exit 1
  140                 shift
  141                 ;;
  142             --type=*)
  143                 _arg_type="$(type "${_key##--type=}" "type")" || exit 1
  144                 ;;
  145             -t*)
  146                 _arg_type="$(type "${_key##-t}" "type")" || exit 1
  147                 ;;
  148             --no-library|--library)
  149                 _arg_library="on"
  150                 test "${1:0:5}" = "--no-" && _arg_library="off"
  151                 ;;
  152             --strip)
  153                 test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  154                 _arg_strip="$(content "$2" "strip")" || exit 1
  155                 shift
  156                 ;;
  157             --strip=*)
  158                 _arg_strip="$(content "${_key##--strip=}" "strip")" || exit 1
  159                 ;;
  160             --no-check-typos|--check-typos)
  161                 _arg_check_typos="on"
  162                 test "${1:0:5}" = "--no-" && _arg_check_typos="off"
  163                 ;;
  164             -c|--no-commented|--commented)
  165                 _arg_commented="on"
  166                 test "${1:0:5}" = "--no-" && _arg_commented="off"
  167                 ;;
  168             -c*)
  169                 _arg_commented="on"
  170                 _next="${_key##-c}"
  171                 if test -n "$_next" -a "$_next" != "$_key"
  172                 then
  173                     { begins_with_short_option "$_next" && shift && set -- "-c" "-${_next}" "$@"; } || die "The short option '$_key' can't be decomposed to ${_key:0:2} and -${_key:2}, because ${_key:0:2} doesn't accept value and '-${_key:2:1}' doesn't correspond to a short option."
  174                 fi
  175                 ;;
  176             -I|--search)
  177                 test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  178                 _arg_search+=("$2")
  179                 shift
  180                 ;;
  181             --search=*)
  182                 _arg_search+=("${_key##--search=}")
  183                 ;;
  184             -I*)
  185                 _arg_search+=("${_key##-I}")
  186                 ;;
  187             --debug)
  188                 test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  189                 _arg_debug="$2"
  190                 shift
  191                 ;;
  192             --debug=*)
  193                 _arg_debug="${_key##--debug=}"
  194                 ;;
  195             -h|--help)
  196                 print_help
  197                 exit 0
  198                 ;;
  199             -h*)
  200                 print_help
  201                 exit 0
  202                 ;;
  203             -v|--version)
  204                 printf '%s %s\n\n%s\n' "argbash" "2.10.0" 'Argbash is an argument parser generator for Bash.'
  205                 exit 0
  206                 ;;
  207             -v*)
  208                 printf '%s %s\n\n%s\n' "argbash" "2.10.0" 'Argbash is an argument parser generator for Bash.'
  209                 exit 0
  210                 ;;
  211             *)
  212                 _last_positional="$1"
  213                 _positionals+=("$_last_positional")
  214                 _positionals_count=$((_positionals_count + 1))
  215                 ;;
  216         esac
  217         shift
  218     done
  219 }
  220 
  221 
  222 handle_passed_args_count()
  223 {
  224     local _required_args_string="'input'"
  225     test "${_positionals_count}" -ge 1 || _PRINT_HELP=yes die "FATAL ERROR: Not enough positional arguments - we require exactly 1 (namely: $_required_args_string), but got only ${_positionals_count}." 1
  226     test "${_positionals_count}" -le 1 || _PRINT_HELP=yes die "FATAL ERROR: There were spurious positional arguments --- we expect exactly 1 (namely: $_required_args_string), but got ${_positionals_count} (the last one was: '${_last_positional}')." 1
  227 }
  228 
  229 
  230 assign_positional_args()
  231 {
  232     local _positional_name _shift_for=$1
  233     _positional_names="_arg_input "
  234 
  235     shift "$_shift_for"
  236     for _positional_name in ${_positional_names}
  237     do
  238         test $# -gt 0 || break
  239         eval "$_positional_name=\${1}" || die "Error during argument parsing, possibly an Argbash bug." 1
  240         shift
  241     done
  242 }
  243 
  244 parse_commandline "$@"
  245 handle_passed_args_count
  246 assign_positional_args 1 "${_positionals[@]}"
  247 
  248 # OTHER STUFF GENERATED BY Argbash
  249 script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || { echo "Couldn't determine the script's running directory, which probably matters, bailing out" >&2; exit 2; }
  250 # Validation of values
  251 
  252 
  253 
  254 ### END OF CODE GENERATED BY Argbash (sortof) ### ])
  255 # [ <-- needed because of Argbash
  256 
  257 #
  258 
  259 _files_to_clean=()
  260 cleanup()
  261 {
  262     test "${#_files_to_clean[*]}" != 0 && rm -f "${_files_to_clean[@]}"
  263 }
  264 
  265 # $1: What (string) to pipe to autom4te
  266 run_autom4te()
  267 {
  268     printf '%s\n' "$1" \
  269         | autom4te "${DEBUG[@]}" -l m4sugar -I "$m4dir"
  270     return $?
  271 }
  272 
  273 
  274 # TODO: Refactor to associative arrays as soon as the argbash online is sufficiently reliable
  275 # We don't use associative arrays due to old bash compatibility reasons
  276 autom4te_error_messages=(
  277     'end of file in string'
  278     'end of file in argument list'
  279 )
  280 # the %.s means "null format"
  281 argbash_error_response_stem=(
  282     'You seem to have an unmatched square bracket on line %d:\n\t%s\n'
  283     "You seem to have a '(' open parenthesis unmatched by a closing one somewhere above the line %d (%s)\\n"
  284 )
  285 
  286 # $1: The error string
  287 # $2: The input (that caused the error)
  288 # $3: The number of the first line of the actual file input by the user
  289 interpret_error()
  290 {
  291     # print the error, smart stuff may follow
  292     printf '%s\n' "$1"
  293     local eof_lineno line_mentioned
  294     for idx in "${!autom4te_error_messages[@]}"
  295     do
  296         eof_lineno="$(printf "%s" "$1" | grep -e "${autom4te_error_messages[$idx]}" | sed -e 's/.*:\([0-9]\+\).*/\1/')"
  297         if test -n "$eof_lineno"
  298         then
  299             line_mentioned="$(printf '%s' "$2" | sed -n "$eof_lineno"p | tr -d '\n\r')"
  300             printf "${argbash_error_response_stem[$idx]}" "$((eof_lineno - $3))" "$line_mentioned"
  301         fi
  302         eof_lineno=''
  303     done
  304 }
  305 
  306 # $1: The input file
  307 # $2: The original intended output file
  308 define_file_metadata()
  309 {
  310     local _defines='' _intended_destination="$ARGBASH_INTENDED_DESTINATION" _input_dirname _output_dirname
  311     test -n "$_intended_destination" || _intended_destination="$2"
  312 
  313     _input_dirname="$(dirname "$1")"
  314     test "$1" != '-' && _defines="${_defines}m4_define([INPUT_BASENAME], [[$(basename "$1")]])"
  315     _defines="${_defines}m4_define([INPUT_ABS_DIRNAME], [[$(cd "$_input_dirname" && pwd)]])"
  316 
  317     _output_dirname="$(dirname "$_intended_destination")"
  318     test "$_intended_destination" != '-' && _defines="${_defines}m4_define([OUTPUT_BASENAME], [[$(basename "$_intended_destination" "$SPURIONS_OUTPUT_SUFFIX")]])"
  319     _defines="${_defines}m4_define([OUTPUT_ABS_DIRNAME], [[$(cd "$_output_dirname" && pwd)]])"
  320     printf "%s" "$_defines"
  321 }
  322 
  323 
  324 assert_m4_files_are_readable()
  325 {
  326     local _argbash_lib="$m4dir/argbash-lib.m4"
  327     test -d "$m4dir" && test -x "$m4dir" || die "The directory '$m4dir' with files needed by Argbash is not browsable. Check whether it exists and review it's permissions."
  328     test -r "$_argbash_lib" && test -f "$_argbash_lib" || die "The '$_argbash_lib' file needed by Argbash is not readable. Check whether it exists and review it's permissions."
  329     test -r "$output_m4" && test -f "$output_m4" || die "The '$output_m4' file needed by Argbash is not readable. Check whether it exists and review it's permissions."
  330 }
  331 
  332 
  333 # The main function that generates the parsing script body
  334 # $1: The input file
  335 # $2: The output file
  336 # $3: The argument type
  337 do_stuff()
  338 {
  339     local _pass_also="$_wrapped_defns" input prefix_len _ret
  340     test "$_arg_commented" = on && _pass_also="${_pass_also}m4_define([COMMENT_OUTPUT])"
  341     _pass_also="${_pass_also}m4_define([_OUTPUT_TYPE], [[$3]])"
  342     _pass_also="${_pass_also}$(define_file_metadata "$_arg_input" "$2")"
  343     input="$(printf '%s\n' "$_pass_also" | cat - "$m4dir/argbash-lib.m4" "$output_m4")"
  344     prefix_len=$(printf '%s\n' "$input" | wc -l)
  345     input="$(printf '%s\n' "$input" | cat - "$1")"
  346     run_autom4te "$input" 2> "$discard" \
  347         | grep -v '^#\s*needed because of Argbash -->\s*$' \
  348         | grep -v '^#\s*<-- needed because of Argbash\s*$'
  349     _ret=$?
  350     if test $_ret != 0
  351     then
  352         local errstr
  353         errstr="$(run_autom4te "$input" 2>&1 > "$discard")"
  354         interpret_error "$errstr" "$input" "$prefix_len" >&2
  355         echo "Error during autom4te run, aborting!" >&2;
  356         exit $_ret;
  357     fi
  358     return "$_ret"
  359 }
  360 
  361 # Fills content to variable _wrapped_defns --- where are scripts of given stems
  362 # $1: Infile
  363 # $2: Stem - what should be the umbrella of the args
  364 settle_wrapped_fname()
  365 {
  366     # Get arguments to ARGBASH_WRAP
  367     # Based on http://stackoverflow.com/a/19772067/592892
  368     local _srcfiles=() _file_found _found ext srcstem searchdir line stem="$2"
  369     while read -r line; do
  370         _srcfiles+=("$line")
  371     done < <(echo 'm4_changecom()m4_define([ARGBASH_WRAP])' "$(cat "$1")" \
  372             | autom4te -l m4sugar -t 'ARGBASH_WRAP:$1' 2> "$discard")
  373 
  374     test "${#_srcfiles[@]}" -gt 0 || return
  375     for srcstem in "${_srcfiles[@]}"
  376     do
  377         _found=no
  378         for searchdir in "${_arg_search[@]}"
  379         do
  380             test -f "$searchdir/$srcstem.m4" && { _found=yes; ext='.m4'; break; }
  381             test -f "$searchdir/$srcstem.sh" && { _found=yes; ext='.sh'; break; }
  382             test -f "$searchdir/$srcstem" && { _found=yes; ext=''; break; }
  383         done
  384         # The last searchdir is a correct one
  385         test $_found = yes || die "Couldn't find wrapped file of stem '$srcstem' in any of directories: ${_arg_search[*]}" 2
  386         _file_found="$searchdir/${srcstem}${ext}"
  387         stem=${2:-$srcstem}
  388         settle_wrapped_fname "$_file_found" "$stem"
  389         _wrapped_defns="${_wrapped_defns}m4_define([_GROUP_OF_$srcstem], [[$stem]])m4_define([_SCRIPT_$srcstem], [[$_file_found]])"
  390     done
  391 }
  392 
  393 # If we want to have the parsing code in a separate file,
  394 # 1. Find out the (possible) filename
  395 # 2. If the file exists, finish (OK).
  396 # 3. If the .m4 file exists, finish (OK)
  397 # 4. Something is wrong
  398 get_parsing_code()
  399 {
  400     local _shfile _m4file _newerfile
  401     # Get the argument of INCLUDE_PARSING_CODE
  402     _srcfile="$(echo 'm4_changecom()m4_define([INCLUDE_PARSING_CODE])' "$(cat "$infile")" \
  403             | autom4te -l m4sugar -t 'INCLUDE_PARSING_CODE:$1' 2> "$discard" \
  404             | tail -n 1)"
  405     test -n "$_srcfile" || return 1
  406     _thatfile="$(dirname "$infile")/$_srcfile"
  407     test -f "$_thatfile" && _shfile="$_thatfile"
  408     # Take out everything after last dot (http://stackoverflow.com/questions/125281/how-do-i-remove-the-file-suffix-and-path-portion-from-a-path-string-in-bash)
  409     _thatfile="${_thatfile%.*}.m4"
  410     test -f "$_thatfile" && _m4file="$_thatfile"
  411 
  412     # if have neither of files
  413     test -z "$_shfile" && test -z "$_m4file" && echo "Strange, we think that there was a source file '$_srcfile' that should be included, but we haven't found it in directory '$(dirname "$_thatfile")'" >&2 && return 1
  414     # We have one file, but not the other one => decision of what to pick is easy.
  415     test -z "$_shfile" && test -n "$_m4file" && echo "$_m4file" && return
  416     test -n "$_shfile" && test -z "$_m4file" && echo "$_shfile" && return
  417 
  418     # We have both, so we pick up the newer one
  419     _newerfile="$_shfile"
  420     test "$_m4file" -nt "$_shfile" && _newerfile="$_m4file"
  421     echo "$_newerfile"
  422 }
  423 
  424 
  425 # $1: The output file
  426 # $2: The output type string
  427 set_output_permission()
  428 {
  429     if grep -q '\<script\>' <<< "$2"
  430     then
  431         chmod a+x "$1"
  432     fi
  433 }
  434 
  435 
  436 # MS Windows compatibility fix
  437 discard=/dev/null
  438 test -e $discard || discard=NUL
  439 
  440 set -o pipefail
  441 
  442 infile="$_arg_input"
  443 
  444 trap cleanup EXIT
  445 # If we are reading from stdout, then create a temp file
  446 if test "$infile" = '-'
  447 then
  448     if test "$_arg_in_place" = 'on'
  449     then
  450         echo "Cannot use stdin input with --in-place option!" >&2
  451         exit 1;
  452     fi
  453     infile=temp_in_$$
  454     _files_to_clean+=("$infile")
  455     cat > "$infile"
  456 fi
  457 
  458 m4dir="$script_dir/../src"
  459 test -n "$_arg_debug" && DEBUG=('-t' "$_arg_debug")
  460 
  461 output_m4="$m4dir/output-strip-none.m4"
  462 test "$_arg_library" = "on" && { echo "The --library option is deprecated, use --strip user-content" next time >&2; _arg_strip="user-content"; }
  463 if test "$_arg_strip" = "user-content"
  464 then
  465     output_m4="$m4dir/output-strip-user-content.m4"
  466 elif test "$_arg_strip" = "all"
  467 then
  468     output_m4="$m4dir/output-strip-all.m4"
  469 fi
  470 
  471 test -f "$infile" || _PRINT_HELP=yes die "argument '$infile' is supposed to be a file!" 1
  472 if test "$_arg_in_place" = on
  473 then
  474     _arg_output="$infile"
  475 fi
  476 test -n "$_arg_output" || { echo "The output can't be blank - it is not a legal filename!" >&2; exit 1; }
  477 outfname="$_arg_output"
  478 autom4te --version > "$discard" 2>&1 || { echo "You need the 'autom4te' utility (it comes with 'autoconf'), if you have bash, that one is an easy one to get." 2>&1; exit 1; }
  479 _arg_search+=("$(dirname "$infile")")
  480 _wrapped_defns=""
  481 
  482 # So let's settle the parsing code first. Hopefully we won't create a loop.
  483 parsing_code="$(get_parsing_code)"
  484 # Just if the original was m4, we replace .m4 with .sh
  485 test -n "$parsing_code" && parsing_code_out="${parsing_code:0:-2}sh"
  486 test "$_arg_library" = off && test -n "$parsing_code" && ($0 --strip user-content "$parsing_code" -o "$parsing_code_out")
  487 
  488 # We may use some of the wrapping stuff, so let's fill the _wrapped_defns
  489 settle_wrapped_fname "$infile"
  490 
  491 assert_m4_files_are_readable
  492 output="$(do_stuff "$infile" "$outfname" "$_arg_type")" || die "" "$?"
  493 if test "$_arg_check_typos" = on
  494 then
  495     # match against suspicious, then inverse match against correct stuff:
  496     # #<optional whitespace>\(allowed\|another allowed\|...\)<optional whitespace><opening bracket <or> end of line>
  497     # 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_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_PROGRAM\)\s*\((\|$\)' | sed -e 's/#\s*\([[:alnum:]_]*\).*/\1 /' | tr -d '\n\r')"
  499     test -n "$grep_output" && die "Your script contains possible misspelled Argbash macros: $grep_output" 1
  500 fi
  501 if test "$outfname" != '-'
  502 then
  503     printf "%s\\n" "$output" > "$outfname"
  504     set_output_permission "$outfname" "$_arg_type"
  505 else
  506     printf "%s\\n" "$output"
  507 fi
  508 
  509 # # ] <-- needed because of Argbash