Re: [PATCH] test-lib: allow short options to be stacked
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Mar 21, 2020, 08:55 UTC
- Message-ID
- <2a54d866-c40e-da5e-4c0c-6bfcb56eb8f7@kdbg.org>
- In-Reply-To
- <48c28683412e3e0803d4c7189a6d66daddcdc580.1584759277.git.matheus.bernardino@usp.br>
Am 21.03.20 um 04:07 schrieb Matheus Tavares:
Show 18 quoted lines
> + > +# Parse options while taking care to leave $@ intact, so we will still > +# have all the original command line options when executing the test > +# script again for '--tee' and '--verbose-log' below. > +store_arg_to= > +prev_opt= > +for opt > +do > + if test -n "$store_arg_to" > + then > + eval $store_arg_to=\$opt > + store_arg_to= > + prev_opt= > + continue > + fi > + > + case "$opt" in > + --*)
Can we please have a case arm for -? here:
--* | -?)
so that we do not pay the price of many sub-processes when options are _not_ stacked?
Show 15 quoted lines
> + parse_option "$opt" ;;
> + -?*)
> + # stacked short options must be fed separately to parse_option
> + for c in $(echo "${opt#-}" | sed 's/./& /g')
> + do
> + parse_option "-$c"
> + done
> + ;;
> + *)
> + echo "error: unknown test option '$opt'" >&2; exit 1 ;;
> + esac
>
> prev_opt=$opt
> done
> -- Hannes