Re: [PATCH 4/5 v4] log: parse detached options like git log --grep foo
- From
Miles Bader <miles@gnu.org>
- Date
- Aug 4, 2010, 02:41 UTC
- Message-ID
- <87sk2v14n4.fsf@catnip.gol.com>
- In-Reply-To
- <7vlj8nipl9.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> this---the users won't miss the "--opt <string>" feature because that is > not a common practice. > > And I was agreeing to that.
No, that would be not good -- GNU getopt_long supports that form, and AFAICT, both the "--foo=bar" and "--foo bar" forms are widely used (I certainly use both all the time), for roughly the same reasons both "-Oarg" and "-O arg" are both common[*].
In the case of "optional-argument options", the "--foo bar" (and "-O bar") form doesn't work, which is an unfortunate (but apparently unavoidable) inconsistency, but optional-argument options are rare enough that this doesn't really effect the usage patterns of more conventional options.
[*] both forms are useful -- sometimes it's handy to bundle up the option-argument with the option, e.g., when writing a throw-away script, to avoid whitespace issues, but sometimes it's useful to keep it separate, e.g. so that shell filename completion works on the option-argument.
-Miles
-- Justice, n. A commodity which in a more or less adulterated condition the State sells to the citizen as a reward for his allegiance, taxes and personal service.