Re: [PATCH v3 6/9] help: simplify by moving to OPT_CMDMODE()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 23, 2021, 18:05 UTC
- Message-ID
- <xmqq4kab182q.fsf@gitster.g>
- In-Reply-To
- <patch-v3-6.9-b52269eeab9-20210921T223223Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 5 quoted lines
> 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.
Show 18 quoted lines
> 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.