File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 299299# # @showinitializer
300300declare -r ARGSPARSE_VERSION=1.8
301301
302+
303+ # # @var ARGSPARASE_GNU_GETOPT
304+ # # @brief the location of the GNU getopt program.
305+ # # @details If empty (the default), a PATH lookup will be
306+ # # performed. When specified, it should be an absolute-path reference
307+ # # as current working directory invariance is not guaranteed.
308+ # # @showinitializer
309+ declare ARGSPARSE_GNU_GETOPT=${ARGSPARSE_GNU_GETOPT:- getopt}
310+
311+
302312# Enable required features
303313shopt -s extglob
304314set +o posix
@@ -1710,6 +1720,7 @@ __argsparse_parse_options_valuecheck() {
17101720 return 0
17111721}
17121722
1723+
17131724# # @fn __argsparse_parse_options_no_usage()
17141725# # @brief Parse options without triggering usage
17151726__argsparse_parse_options_no_usage () {
@@ -1759,7 +1770,7 @@ __argsparse_parse_options_no_usage() {
17591770 done
17601771
17611772 # 4. Invoke getopt and replace arguments.
1762- if ! getopt_temp=$( getopt -s bash -n " $argsparse_pgm " \
1773+ if ! getopt_temp=$( " ${ARGSPARSE_GNU_GETOPT} " -s bash -n " $argsparse_pgm " \
17631774 --longoptions=" $longs " " $shorts " " $@ " )
17641775 then
17651776 # Syntax error on the command implies returning with error.
You can’t perform that action at this time.
0 commit comments