1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-06-14 22:15:13 +02:00

cli: add --stop-on-nonmatch flag

This causes ripgrep to stop searching an individual file after it has
found a non-matching line. But this only occurs after it has found a
matching line.

Fixes #1790, Closes #1930
This commit is contained in:
Edoardo Pirovano
2021-07-07 17:50:23 +01:00
committed by Andrew Gallant
parent 4782ebd5e0
commit 6d95c130d5
7 changed files with 99 additions and 12 deletions

View File

@ -821,7 +821,8 @@ impl ArgMatches {
.before_context(ctx_before)
.after_context(ctx_after)
.passthru(self.is_present("passthru"))
.memory_map(self.mmap_choice(paths));
.memory_map(self.mmap_choice(paths))
.stop_on_nonmatch(self.is_present("stop-on-nonmatch"));
match self.encoding()? {
EncodingMode::Some(enc) => {
builder.encoding(Some(enc));