mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-09-01 04:43:53 -07:00
cli: add --include-zero flag
This flag, when used in conjunction with --count or --count-matches, will print a result for each file searched even if there were zero matches in that file. This is off by default but can be enabled to make ripgrep behave more like grep. This also clarifies some of the defaults for the grep-printer::SummaryBuilder type. Closes #1370, Closes #1405
This commit is contained in:
committed by
Andrew Gallant
parent
4628d77808
commit
a070722ff2
@@ -202,6 +202,8 @@ impl SummaryBuilder {
|
||||
/// This completely overrides any previous color specifications. This does
|
||||
/// not add to any previously provided color specifications on this
|
||||
/// builder.
|
||||
///
|
||||
/// The default color specifications provide no styling.
|
||||
pub fn color_specs(
|
||||
&mut self,
|
||||
specs: ColorSpecs,
|
||||
@@ -256,6 +258,8 @@ impl SummaryBuilder {
|
||||
/// If multi line search is enabled and a match spans multiple lines, then
|
||||
/// that match is counted exactly once for the purposes of enforcing this
|
||||
/// limit, regardless of how many lines it spans.
|
||||
///
|
||||
/// This is disabled by default.
|
||||
pub fn max_matches(&mut self, limit: Option<u64>) -> &mut SummaryBuilder {
|
||||
self.config.max_matches = limit;
|
||||
self
|
||||
@@ -266,6 +270,8 @@ impl SummaryBuilder {
|
||||
/// When enabled and the mode is either `Count` or `CountMatches`, then
|
||||
/// results are not printed if no matches were found. Otherwise, every
|
||||
/// search prints a result with a possibly `0` number of matches.
|
||||
///
|
||||
/// This is enabled by default.
|
||||
pub fn exclude_zero(&mut self, yes: bool) -> &mut SummaryBuilder {
|
||||
self.config.exclude_zero = yes;
|
||||
self
|
||||
@@ -292,6 +298,8 @@ impl SummaryBuilder {
|
||||
/// A typical use for this option is to permit cygwin users on Windows to
|
||||
/// set the path separator to `/` instead of using the system default of
|
||||
/// `\`.
|
||||
///
|
||||
/// This is disabled by default.
|
||||
pub fn separator_path(
|
||||
&mut self,
|
||||
sep: Option<u8>,
|
||||
|
Reference in New Issue
Block a user