From 03f76053228b646a7febed3853ab28f42b83b1ad Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sat, 19 Nov 2016 20:15:41 -0500 Subject: [PATCH] Rename --files-without-matches to --files-without-match. This is to be consistent with grep. --- doc/rg.1 | 2 +- doc/rg.1.md | 2 +- src/app.rs | 4 ++-- src/args.rs | 2 +- src/search_stream.rs | 4 ++-- tests/tests.rs | 7 ++++--- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/doc/rg.1 b/doc/rg.1 index 2442a43f1..d07909555 100644 --- a/doc/rg.1 +++ b/doc/rg.1 @@ -182,7 +182,7 @@ Only show path of each file with matches. .RS .RE .TP -.B \-\-files\-without\-matches +.B \-\-files\-without\-match Only show path of each file with no matches. .RS .RE diff --git a/doc/rg.1.md b/doc/rg.1.md index 3980e8737..8e6226d7c 100644 --- a/doc/rg.1.md +++ b/doc/rg.1.md @@ -119,7 +119,7 @@ Project home page: https://github.com/BurntSushi/ripgrep -l, --files-with-matches : Only show path of each file with matches. ---files-without-matches +--files-without-match : Only show path of each file with no matches. -H, --with-filename diff --git a/src/app.rs b/src/app.rs index a549bc598..33dfb2715 100644 --- a/src/app.rs +++ b/src/app.rs @@ -124,7 +124,7 @@ fn app(next_line_help: bool, doc: F) -> App<'static, 'static> .value_name("FILE").takes_value(true) .multiple(true).number_of_values(1)) .arg(flag("files-with-matches").short("l")) - .arg(flag("files-without-matches")) + .arg(flag("files-without-match")) .arg(flag("with-filename").short("H")) .arg(flag("no-filename")) .arg(flag("heading")) @@ -305,7 +305,7 @@ lazy_static! { lines, and the newline is not counted as part of the pattern."); doc!(h, "files-with-matches", "Only show the path of each file with at least one match."); - doc!(h, "files-without-matches", + doc!(h, "files-without-match", "Only show the path of each file that contains zero matches."); doc!(h, "with-filename", "Show file name for each match.", diff --git a/src/args.rs b/src/args.rs index 58cdee617..836b28194 100644 --- a/src/args.rs +++ b/src/args.rs @@ -316,7 +316,7 @@ impl<'a> ArgMatches<'a> { context_separator: self.context_separator(), count: self.is_present("count"), files_with_matches: self.is_present("files-with-matches"), - files_without_matches: self.is_present("files-without-matches"), + files_without_matches: self.is_present("files-without-match"), eol: b'\n', files: self.is_present("files"), follow: self.is_present("follow"), diff --git a/src/search_stream.rs b/src/search_stream.rs index b92fa806b..d4478170d 100644 --- a/src/search_stream.rs +++ b/src/search_stream.rs @@ -112,13 +112,13 @@ impl Default for Options { impl Options { /// Several options (--quiet, --count, --files-with-matches, - /// --files-without-matches) imply that we shouldn't ever display matches. + /// --files-without-match) imply that we shouldn't ever display matches. pub fn skip_matches(&self) -> bool { self.count || self.files_with_matches || self.files_without_matches || self.quiet } - /// Some options (--quiet, --files-with-matches, --files-without-matches) + /// Some options (--quiet, --files-with-matches, --files-without-match) /// imply that we can stop searching after the first match. pub fn stop_after_first_match(&self) -> bool { self.files_with_matches || self.files_without_matches || self.quiet diff --git a/tests/tests.rs b/tests/tests.rs index 66c2e51c1..47169191d 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -339,9 +339,10 @@ sherlock!(files_with_matches, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| { assert_eq!(lines, expected); }); -sherlock!(files_without_matches, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| { +sherlock!(files_without_matches, "Sherlock", ".", +|wd: WorkDir, mut cmd: Command| { wd.create("file.py", "foo"); - cmd.arg("--files-without-matches"); + cmd.arg("--files-without-match"); let lines: String = wd.stdout(&mut cmd); let expected = "file.py\n"; assert_eq!(lines, expected); @@ -1070,7 +1071,7 @@ sherlock!(feature_89_files_with_matches, "Sherlock", ".", sherlock!(feature_89_files_without_matches, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| { wd.create("file.py", "foo"); - cmd.arg("--null").arg("--files-without-matches"); + cmd.arg("--null").arg("--files-without-match"); let lines: String = wd.stdout(&mut cmd); assert_eq!(lines, "file.py\x00");