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

Re: [PATCH] grep: document negated line-number, column long options

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 21, 2025, 20:51 UTC
Message-ID
<xmqqjzanzy8k.fsf@gitster.g>
In-Reply-To
<CALnO6CBUbmZaL1NuG2RxrvuxbUexKdtKfgYi2jTDY3QEa9NQkA@mail.gmail.com>
"D. Ben Knoble" <ben.knoble+github@gmail.com> writes:
Show 15 quoted lines
>> $ git grep -e '^--\[no-\]' Documentation/
>>
>> An example entry (this is from blame-options.txt) looks like this.
>>
>>     --[no-]progress::
>>             Progress status is reported on the standard error stream
>>             by default when it is attached to a terminal. This flag
>>             enables progress reporting even if not attached to a
>>             terminal. Can't use `--progress` together with `--porcelain`
>>             or `--incremental`.
>
> Fair enough; I dislike the `[no-]` formatting because it is harder to
> build into a search pattern (I have Vim keybindings to search manuals
> for long and short options that it breaks), but I will probably live
> with it and adjust my search patterns rather than complain further.
$ git grep -e '^[`]*--\[no-\]' -e '^[`]*--no-' Documentation/
tells us that we also can write the above more like so:
	--progress::
	--no-progress::
		Progress status is reported ...

which may make it more palatable? I didn't count and sift the hits into two bin to see which style is more prevalent, but it may not be a bad idea to consider unifying into one style.

> Sounds like you would prefer a re-roll that does something similar for
> `--[no-]line-number` and `--[no-]column`? I suppose I have to
> wonder—for which Boolean options is it worth doing so?

Ones that are not marked with OPT_NONEG all take --no- variant, and while going through the list of options we may realize some of them should *not* take negated forms. They all commonly share that "giving --no-opt countermands an earlier --opt or the corresponding configuration variable setting", and any "--opt" that has its own corresponding configuration variable should already have the variable documented in the paragraph, the body text may not have to be updated at all in the best case (in other words, the only change required may be to add lines of "--no-foo::" form next to existing "--foo::".

Thanks.
Previous: D. Ben Knoble
Message 9 of 9 in “grep: document negated line-number, column long options”
  1. grep: document negated line-number, column long optionsD. Ben Knoble via GitGitGadget, Jan 16, 2025
  2. Junio C HamanoJan 16, 2025
  3. Junio C HamanoJan 17, 2025
  4. gitcli: document that command line trumps config and envJunio C Hamano, Jan 17, 2025
  5. brian m. carlsonJan 17, 2025
  6. Junio C HamanoJan 17, 2025
  7. Eric SunshineJan 17, 2025
  8. D. Ben KnobleJan 19, 2025
  9. Junio C HamanoJan 21, 2025

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.