Re: [PATCH] builtin/config.c: prefer `--type=bool` over `--bool`, etc.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 30, 2018, 16:00 UTC
- Message-ID
- <xmqqmuyp4kqi.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180330135315.GE29568@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> ... But actually, last-one-wins applies only > to a _single_ option, not necessarily unrelated ones. Many other > multi-action commands actually have a series of separate boolean flags, > and then complain when more than one of the flags is set. > > So maybe it's not such a good idea for the actions (I do still think > it's the right path for the types).
If this were using command verbs (e.g. "git config get foo.bar") as opposed to command options (e.g. "git config --get foo.bar"), it wouldn't ahve allowed multiple command verbs from the command line, and last-one-wins would not have made much sense because there is no way to trigger it as a desirable "feature".
Just like the topic of the discussion unifies --int/--bool/etc. into a single --type={int,bool,...}, perhaps the existing command options --get/--list/etc. can be taken as if they were a mistaken historical way to spell --action={get,list,...}. I of course am not recommending to add a new "--action" option. I am suggesting it as a thought-aid to see if actions are all that different from value type options.
I agree that a-bit-per-type that is checked with HAS_MULTI_BITS() for error at the end does not make much sense. I also think what you did in this patch for actions is a good clean-up for the above reason.