Re: [PATCH v2] test-lib: allow short options to be bundled
- From
Matheus Tavares Bernardino <matheus.bernardino@usp.br>
- Date
- Mar 21, 2020, 22:42 UTC
- Message-ID
- <CAHd-oW6V4cTpf4L-usGYEOMrn_VOY7ajMpBeLzfs_NTyi8pbxg@mail.gmail.com>
- In-Reply-To
- <xmqqtv2h8oac.fsf@gitster.c.googlers.com>
On Sat, Mar 21, 2020 at 5:07 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
>
> Matheus Tavares <matheus.bernardino@usp.br> writes:
>
> > +opt_required_arg=
> > +# $1: option string
> > +# $2: name of the var where the arg will be stored
> > +mark_option_requires_arg ()
> > +{
>
> "{" on the same line, just like you did for parse_option below.Thanks. Will fix.
Show 18 quoted lines
> > + if test -n "$opt_required_arg"
> > then
> > + echo "error: options that require args cannot be bundled" \
> > + "together: '$opt_required_arg' and '$1'" >&2
> > + exit 1
> > fi
> > + opt_required_arg=$1
> > + store_arg_to=$2
> > +}
> > +
> > +parse_option () {
> > + local opt="$1"
> > ...
> > + case "$opt" in
> > + --*)
> > + parse_option "$opt" ;;
>
> I think J6t's suggestion to the previous round still has merit here.Yeah, I agree with your last reply that it makes the codeflow clearer. I'll wait a bit to see if anyone else has other comments about this iteration and then send v3 with both changes.
Thanks.