diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-09-22 00:40:36 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-23 10:30:43 -0700 |
commit | d35d03cf93ef0dba3e975c78fce73db91d52ba42 (patch) | |
tree | d73e8950e435eeb64934855c8454d3d1754918e8 /commit.h | |
parent | help: correct logic error in combining --all and --guides (diff) | |
download | tgif-d35d03cf93ef0dba3e975c78fce73db91d52ba42.tar.xz |
help: simplify by moving to OPT_CMDMODE()
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.
This is the first command with a hidden CMDMODE, so let's introduce a
OPT_CMDMODE_F() macro to go along with OPT_CMDMODE().
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
$
But improving that is a general topic for parse-options.c improvement,
i.e. we should probably emit the full usage in that case.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
0 files changed, 0 insertions, 0 deletions