1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-04-24 17:12:16 +02:00

Add -0 shortcut for --null

Fixes #419
This commit is contained in:
Roman Proskuryakov 2017-03-28 19:06:30 +03:00 committed by Andrew Gallant
parent b4bc3b6349
commit 01deac9427
3 changed files with 11 additions and 2 deletions

View File

@ -243,7 +243,7 @@ Project home page: https://github.com/BurntSushi/ripgrep
: Don't respect version control ignore files (e.g., .gitignore). : Don't respect version control ignore files (e.g., .gitignore).
Note that .ignore files will continue to be respected. Note that .ignore files will continue to be respected.
--null -0, --null
: Whenever a file name is printed, follow it with a NUL byte. : Whenever a file name is printed, follow it with a NUL byte.
This includes printing filenames before matches, and when printing This includes printing filenames before matches, and when printing
a list of matching files such as with --count, --files-with-matches a list of matching files such as with --count, --files-with-matches

View File

@ -158,7 +158,7 @@ fn app<F>(next_line_help: bool, doc: F) -> App<'static, 'static>
.arg(flag("no-ignore")) .arg(flag("no-ignore"))
.arg(flag("no-ignore-parent")) .arg(flag("no-ignore-parent"))
.arg(flag("no-ignore-vcs")) .arg(flag("no-ignore-vcs"))
.arg(flag("null")) .arg(flag("null").short("0"))
.arg(flag("path-separator").value_name("SEPARATOR").takes_value(true)) .arg(flag("path-separator").value_name("SEPARATOR").takes_value(true))
.arg(flag("pretty").short("p")) .arg(flag("pretty").short("p"))
.arg(flag("replace").short("r").value_name("ARG").takes_value(true)) .arg(flag("replace").short("r").value_name("ARG").takes_value(true))

View File

@ -1390,6 +1390,15 @@ clean!(feature_275_pathsep, "test", ".", |wd: WorkDir, mut cmd: Command| {
assert_eq!(lines, "fooZbar:test\n"); assert_eq!(lines, "fooZbar:test\n");
}); });
// See: https://github.com/BurntSushi/ripgrep/issues/419
sherlock!(feature_419_zero_as_shortcut_for_null, "Sherlock", ".",
|wd: WorkDir, mut cmd: Command| {
cmd.arg("-0").arg("--count");
let lines: String = wd.stdout(&mut cmd);
assert_eq!(lines, "sherlock\x002\n");
});
#[test] #[test]
fn binary_nosearch() { fn binary_nosearch() {
let wd = WorkDir::new("binary_nosearch"); let wd = WorkDir::new("binary_nosearch");