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

Re: [PATCH] grep: correct help string for --exclude-standard

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 4, 2015, 11:46 UTC
Message-ID
<CACsJy8DVG7MZoJcSxkZX5kdE8tLT7HnNqDEins3a2aLThZbWPg@mail.gmail.com>
In-Reply-To
<20150304112603.GA26545@peff.net>
On Wed, Mar 4, 2015 at 6:26 PM, Jeff King <peff@peff.net> wrote:
Show 27 quoted lines
>> > It might be nice if parseopt had a PARSE_OPT_NEGHELP option or something
>> > to show the "--no-" form.
>>
>> Regardless, yes it would be nice to have something like this. I think
>> there are places that can make use of this.
>
> Grepping around, it looks like the best form would be an OPT_NEGBOOL
> that acts like a boolean but negates the truth value, and advertises the
> negative form. We have a lot of:
>
>   OPT_BOOL('n', "no-checkout", &option_no_checkout,
>            N_("don't create a checkout"))
>
> where countermanding an earlier "--no-checkout" has to be spelled as
> "--no-no-checkout", rather than "--checkout". If we could write:
>
>   OPT_NEGBOOL('n', "checkout", ...)
>
> that would be nicer. But the short option is a bit weird. We'd want:
>
>   -n: option_no_checkout=true
>   --checkout: option_no_checkout=false
>   --no-checkout: option_no_checkout=true
>
> That is, we flip the sense of the long option, but the short option
> still yields "true". I think that would be useful, but it sure is weird
> to explain.

Yeah it looks confusing.. How about leaving that first arg as the short option "checkout" and move 'n' elsewhere? Something like this

OPT_NEGBOOL(0, "checkout", 'n', ....)
-- 
Duy
Previous: Jeff King
Message 5 of 5 in “grep: correct help string for --exclude-standard”
  1. grep: correct help string for --exclude-standardNguyễn Thái Ngọc Duy, Feb 27, 2015
  2. Jeff KingMar 4, 2015
  3. Duy NguyenMar 4, 2015
  4. Jeff KingMar 4, 2015
  5. Duy NguyenMar 4, 2015

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.