1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-07-16 22:42:20 +02:00

printer: add --passthru flag

The --passthru flag causes ripgrep to print every line,
even if the line does not contain a match. This is a
response to the common pattern of `^|foo` to match every
line, while still highlighting things like `foo`.

Fixes #740
This commit is contained in:
dana
2018-01-11 17:45:51 -06:00
committed by Andrew Gallant
parent 34c0b1bc70
commit 58bdc366ec
6 changed files with 84 additions and 5 deletions

View File

@ -166,6 +166,8 @@ pub fn app() -> App<'static, 'static> {
.arg(flag("no-ignore-vcs"))
.arg(flag("null").short("0"))
.arg(flag("only-matching").short("o"))
.arg(flag("passthru").alias("passthrough")
.conflicts_with_all(&["only-matching", "replace"]))
.arg(flag("path-separator").value_name("SEPARATOR").takes_value(true))
.arg(flag("pretty").short("p"))
.arg(flag("replace").short("r")
@ -499,6 +501,8 @@ lazy_static! {
"Print only matched parts of a line.",
"Print only the matched (non-empty) parts of a matching line, \
with each such part on a separate output line.");
doc!(h, "passthru",
"Show both matching and non-matching lines.");
doc!(h, "path-separator",
"Path separator to use when printing file paths.",
"The path separator to use when printing file paths. This \