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

[PATCH 1/2] grep: do not use --index in the short usage output

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Sep 15, 2011, 18:26 UTC
Message-ID
<2f376e61802a1a38c67698d5ec263d1807b1fcee.1316110876.git.bert.wesarg@googlemail.com>

Utilize the PARSE_OPT_NEGHELP option to show --no-index in the usage generated by parse-options.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
 builtin/grep.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index 1c359c2..e0562b0 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -774,8 +774,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	struct option options[] = {
 		OPT_BOOLEAN(0, "cached", &cached,
 			"search in index instead of in the work tree"),
-		OPT_BOOLEAN(0, "index", &use_index,
-			"--no-index finds in contents not managed by git"),
+		{ OPTION_BOOLEAN, 0, "index", &use_index, NULL,
+			"finds in contents not managed by git",
+			PARSE_OPT_NOARG | PARSE_OPT_NEGHELP },
 		OPT_GROUP(""),
 		OPT_BOOLEAN('v', "invert-match", &opt.invert,
 			"show non-matching lines"),
-- 
1.7.6.789.gb4599
Next: Bert Wesarg
Message 1 of 8 in “grep: do not use --index in the short usage output”
  1. 1/2 grep: do not use --index in the short usage outputBert Wesarg, Sep 15, 2011
  2. 2/2 grep --no-index: don't use git standard exclusionsBert Wesarg, Sep 15, 2011
  3. Junio C HamanoSep 15, 2011
  4. Bert WesargSep 16, 2011
  5. Re* [PATCH 2/2] grep --no-index: don't use git standard exclusionsJunio C Hamano, Sep 27, 2011
  6. 2/2 grep: --untracked and --exclude testsJunio C Hamano, Sep 27, 2011
  7. Bert WesargSep 28, 2011
  8. Junio C HamanoSep 28, 2011

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.