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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "D. Ben Knoble" <ben.knoble+github@xxxxxxxxx>

I set grep.lineNumber and grep.column on in my user .gitconfig;
sometimes, when I script over the results from `git grep`, I want no
prefixes, only a filename prefix, or only the matched text. I usually
comment out the relevant config sections or use `git -c` to tweak them for
a single run---why? Because `git help grep` doesn't mention they can be
disabled any other way!

Intending to add the ability to negate these options, I reviewed
builtin/grep.c and learned that OPT_BOOL already provides this feature.
Document it for future readers. Borrow "configuration file" language
from `--no-color`, since that's my motivating use case.

Signed-off-by: D. Ben Knoble <ben.knoble+github@xxxxxxxxx>
---
    grep: document negated line-number, column long options

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1878%2Fbenknoble%2Fdocument-grep-negated-options-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1878/benknoble/document-grep-negated-options-v1
Pull-Request: https://github.com/git/git/pull/1878

 Documentation/git-grep.txt | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 1e6d7b65c84..7ec5ad381db 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -13,7 +13,7 @@ SYNOPSIS
 	   [-v | --invert-match] [-h|-H] [--full-name]
 	   [-E | --extended-regexp] [-G | --basic-regexp]
 	   [-P | --perl-regexp]
-	   [-F | --fixed-strings] [-n | --line-number] [--column]
+	   [-F | --fixed-strings] [-n | --[no-]line-number] [--[no-]column]
 	   [-l | --files-with-matches] [-L | --files-without-match]
 	   [(-O | --open-files-in-pager) [<pager>]]
 	   [-z | --null]
@@ -157,10 +157,18 @@ providing this option will cause it to die.
 --line-number::
 	Prefix the line number to matching lines.
 
+--no-line-number::
+	Turn off line number prefixes, even when the configuration file or a
+	previous option requests them.
+
 --column::
 	Prefix the 1-indexed byte-offset of the first match from the start of the
 	matching line.
 
+--no-column::
+	Turn off column prefixes, even when the configuration file or a
+	previous option requests them.
+
 -l::
 --files-with-matches::
 --name-only::

base-commit: 757161efcca150a9a96b312d9e780a071e601a03
-- 
gitgitgadget




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux