mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07:00
parent
95edcd4d3a
commit
9dc5464c84
1
doc/rg.1
1
doc/rg.1
@ -91,6 +91,7 @@ Suppress line numbers.
|
|||||||
.TP
|
.TP
|
||||||
.B \-q, \-\-quiet
|
.B \-q, \-\-quiet
|
||||||
Do not print anything to stdout.
|
Do not print anything to stdout.
|
||||||
|
If a match is found in a file, stop searching that file.
|
||||||
.RS
|
.RS
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
@ -61,7 +61,8 @@ the raw speed of grep.
|
|||||||
: Suppress line numbers.
|
: Suppress line numbers.
|
||||||
|
|
||||||
-q, --quiet
|
-q, --quiet
|
||||||
: Do not print anything to stdout.
|
: Do not print anything to stdout. If a match is found in a file, stop
|
||||||
|
searching that file.
|
||||||
|
|
||||||
-r, --replace *ARG*
|
-r, --replace *ARG*
|
||||||
: Replace every match with the string given. Capture group indices (e.g., $5)
|
: Replace every match with the string given. Capture group indices (e.g., $5)
|
||||||
|
@ -66,7 +66,8 @@ Common options:
|
|||||||
-n, --line-number Show line numbers (1-based). This is enabled
|
-n, --line-number Show line numbers (1-based). This is enabled
|
||||||
by default at a tty.
|
by default at a tty.
|
||||||
-N, --no-line-number Suppress line numbers.
|
-N, --no-line-number Suppress line numbers.
|
||||||
-q, --quiet Do not print anything to stdout.
|
-q, --quiet Do not print anything to stdout. If a match is
|
||||||
|
found in a file, stop searching that file.
|
||||||
-r, --replace ARG Replace every match with the string given.
|
-r, --replace ARG Replace every match with the string given.
|
||||||
Capture group indices (e.g., $5) and names
|
Capture group indices (e.g., $5) and names
|
||||||
(e.g., $foo) are supported.
|
(e.g., $foo) are supported.
|
||||||
|
@ -116,6 +116,11 @@ impl<W: Terminal + Send> Printer<W> {
|
|||||||
self.has_printed
|
self.has_printed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if the printer has been configured to be quiet.
|
||||||
|
pub fn is_quiet(&self) -> bool {
|
||||||
|
self.quiet
|
||||||
|
}
|
||||||
|
|
||||||
/// Flushes the underlying writer and returns it.
|
/// Flushes the underlying writer and returns it.
|
||||||
pub fn into_inner(mut self) -> W {
|
pub fn into_inner(mut self) -> W {
|
||||||
let _ = self.wtr.flush();
|
let _ = self.wtr.flush();
|
||||||
|
@ -104,7 +104,7 @@ impl<'a, W: Send + Terminal> BufferSearcher<'a, W> {
|
|||||||
self.print_match(m.start(), m.end());
|
self.print_match(m.start(), m.end());
|
||||||
}
|
}
|
||||||
last_end = m.end();
|
last_end = m.end();
|
||||||
if self.opts.files_with_matches {
|
if self.printer.is_quiet() || self.opts.files_with_matches {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,8 @@ impl<'a, R: io::Read, W: Terminal + Send> Searcher<'a, R, W> {
|
|||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn terminate(&self) -> bool {
|
fn terminate(&self) -> bool {
|
||||||
return self.opts.files_with_matches && self.match_count > 0;
|
self.match_count > 0
|
||||||
|
&& (self.printer.is_quiet() || self.opts.files_with_matches)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user