Subject: Re: [PATCH v6 0/3] rebase: document, clean up, and introduce a config option for --rebase-merges

From: Junio C Hamano <[email-masked]>
Date: Mon, 06 Mar 2023 09:19:00 -0800

Sergey Organov <[email-masked]> writes:

>> I am curious as to why you say that flags with optional arguments are
>> considered bad practice.
>
> As far as I can tell, the core problem with such options is that generic
> options parsing code can't tell if in "--option value" "value" is an
> argument to "--option", or separate argument, that in turn may lead to
> very surprising behaviors and bugs.

Another one and half reasons are

 * Can there be two or more such options used on a single command
   line?  Unless we limit the command line and say "such an option
   can appear only at the end of options and without any non option
   arguments" (the latter is what you said above), we'd end up with
   a system that cannot be explained to casual users.

 * What about short-form of option?  Is "-abc" asking for three
   options "-a", "-b", and "-c"?  Or is it "-a" option that takes
   optional argument "bc"?

There are some advices we give in "git help cli" to our users, which
we shouldn't have to have given if we rejected flags with optional
arguments in our commands.

Thanks.