Subject: Re: [PATCH v3 6/9] help: simplify by moving to OPT_CMDMODE()

From: Junio C Hamano <[email-masked]>
Date: Thu, 23 Sep 2021 11:05:17 -0700

Ævar Arnfjörð Bjarmason  <[email-masked]> writes:

> As preceding commits have incrementally established all of the --all,
> --guides, --config and hidden --config-for-completion options are
> mutually exclusive. So let's use OPT_CMDMODE() to parse the
> command-line instead, and take advantage of its conflicting options
> detection.

Sounds quite logical.

> I think this makes the usage information that we emit slightly worse,
> e.g. before we'd emit:
>
>     $ git help --all --config
>     fatal: --config and --all cannot be combined
>
>     usage: git help [-a|--all] [--[no-]verbose]]
>              [[-i|--info] [-m|--man] [-w|--web]] [<command>]
>        or: git help [-g|--guides]
>        or: git help [-c|--config]
>     [...]
>     $
>
> And now:
>
>     $ git help --all --config
>     error: option `config' is incompatible with --all
>     $

We often hear that our error messages for command line options are
unhelpful by being too broad, don't we?  I think the new one would
be much better by not scrolling away the most important part.  Those
who want to know about options other than --all and --config can
issue "git help -h" after seeing that single line error, but not
everybody has to do so.

> But improving that is a general topic for parse-options.c improvement,
> i.e. we should probably emit the full usage in that case.

Yes, absolutely.