Add --files-without-matches flag.

Performs the opposite of --files-with-matches: only shows paths of
files that contain zero matches.

Closes #138
This commit is contained in:
Daniel Luz
2016-11-19 21:48:59 -02:00
parent 1e6c2ac8e3
commit bd3e7eedb1
8 changed files with 92 additions and 7 deletions

View File

@@ -339,6 +339,14 @@ sherlock!(files_with_matches, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
assert_eq!(lines, expected);
});
sherlock!(files_without_matches, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
wd.create("file.py", "foo");
cmd.arg("--files-without-matches");
let lines: String = wd.stdout(&mut cmd);
let expected = "file.py\n";
assert_eq!(lines, expected);
});
sherlock!(after_context, |wd: WorkDir, mut cmd: Command| {
cmd.arg("-A").arg("1");
let lines: String = wd.stdout(&mut cmd);
@@ -1058,6 +1066,16 @@ sherlock!(feature_89_files_with_matches, "Sherlock", ".",
assert_eq!(lines, "sherlock\x00");
});
// See: https://github.com/BurntSushi/ripgrep/issues/89
sherlock!(feature_89_files_without_matches, "Sherlock", ".",
|wd: WorkDir, mut cmd: Command| {
wd.create("file.py", "foo");
cmd.arg("--null").arg("--files-without-matches");
let lines: String = wd.stdout(&mut cmd);
assert_eq!(lines, "file.py\x00");
});
// See: https://github.com/BurntSushi/ripgrep/issues/89
sherlock!(feature_89_count, "Sherlock", ".",
|wd: WorkDir, mut cmd: Command| {