builtin/config: use `OPT_CMDMODE()` to specify modes
commitdaa33250240406fd0ff9dfc7625b3784138a8978
authorPatrick Steinhardt <ps@pks.im>
Mon, 6 May 2024 08:56:10 +0000 (6 10:56 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 May 2024 18:50:07 +0000 (6 11:50 -0700)
tree80fae5ed2e0378e58877520549659882b9c26676
parent8415507b3285dd34b4d4edc7b864eede5325b2db
builtin/config: use `OPT_CMDMODE()` to specify modes

The git-config(1) command has various different modes which are
accessible via e.g. `--get-urlmatch` or `--unset-all`. These modes are
declared with `OPT_BIT()`, which causes two minor issues:

  - The respective modes also have a negated form `--no-get-urlmatch`,
    which is unintended.

  - We have to manually handle exclusiveness of the modes.

Switch these options to instead use `OPT_CMDMODE()`, which is made
exactly for this usecase. Remove the now-unneeded check that only a
single mode is given, which is now handled by the parse-options
interface.

While at it, format optional placeholders for arguments to conform to
our style guidelines by using `[<placeholder>]`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/config.c
t/t1300-config.sh