git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/5 v4] log: parse detached options like git log --grep foo

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Aug 3, 2010, 06:33 UTC
Message-ID
<vpq8w4ob3yz.fsf@bauges.imag.fr>
In-Reply-To
<7vsk2wk8lc.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 29 quoted lines
> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
>> Junio C Hamano <gitster@pobox.com> writes:
>>
>>> The patch overall looks good, and this comments illustrates the issue
>>> rather well.  When the user wants to use "--longopt val" syntax, s/he
>>> needs to know that "--longopt" will always take a value.  Arguably
>>> majority of options that can take value will, but like "--stat X,Y" this
>>> leaves things inconsistent.  Without "--longopt value" patch there won't
>>> be such an inconsistency, but I think this patch series is lessor of two
>>> evils.
>>
>> ... especially when parse-option already does this:
>>
>> git commit --message foo   => works
>> git gc --prune 'last week' => doesn't
>>
>> Just like most GNU tools:
>>
>> grep --regexp foo => works
>> grep --color auto => doesn't
>
> Hmm.
>
> Are you hinting that we should keep "you can say '-Ofoo' and '-O foo'"
> bits but we should drop "you can also say '--opt=foo' and '--opt foo' as
> long as --opt always takes an argument"?
>
> I actually think that may make sense.

I'm not sure I parsed your sentence correctly, but if I did, then no, I don't think we should drop separate forms when --opt always takes an argument, just the opposite.

-O<string> => always accepted -O <string> => OK if <string> is mandatory and always non-empty --opt=<sting> => always accepted --opt <string> => OK if <string> is mandatory (possibly empty)

My remark was that there's nothing very original here, what my patch does is what other places of Git did, and that other common tools did years before.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Junio C HamanoNext: Junio C Hamano
Message 20 of 25 in “log and diff: accept detached forms (--option value)”
  1. 0/5 log and diff: accept detached forms (--option value)Matthieu Moy, Jul 29, 2010
  2. 1/5 diff: parse detached options like -S fooMatthieu Moy, Jul 29, 2010
  3. 2/5 diff: split off a function for --stat-* option parsingMatthieu Moy, Jul 29, 2010
  4. 3/5 diff: parse detached options --stat-width n, --stat-name-width nMatthieu Moy, Jul 29, 2010
  5. 4/5 log: parse detached options like git log --grep fooMatthieu Moy, Jul 29, 2010
  6. Jonathan NiederJul 29, 2010
  7. Matthieu MoyJul 30, 2010
  8. 1/5 diff: parse detached options like -S fooMatthieu Moy, Jul 30, 2010
  9. Junio C HamanoAug 2, 2010
  10. Matthieu MoyAug 2, 2010
  11. Jonathan NiederAug 2, 2010
  12. 2/5 diff: split off a function for --stat-* option parsingMatthieu Moy, Jul 30, 2010
  13. 3/5 diff: parse detached options --stat-width n, --stat-name-width nMatthieu Moy, Jul 30, 2010
  14. Junio C HamanoAug 2, 2010
  15. Matthieu MoyAug 2, 2010
  16. 4/5 log: parse detached options like git log --grep fooMatthieu Moy, Jul 30, 2010
  17. Junio C HamanoAug 2, 2010
  18. Matthieu MoyAug 2, 2010
  19. Junio C HamanoAug 2, 2010
  20. Matthieu MoyAug 3, 2010
  21. Junio C HamanoAug 3, 2010
  22. Matthieu MoyAug 3, 2010
  23. Miles BaderAug 4, 2010
  24. 5/5 log: parse detached option for --globMatthieu Moy, Jul 30, 2010
  25. 5/5 log: parse detached option for --globMatthieu Moy, Jul 29, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.