mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-11-29 05:57:07 +02:00
ripgrep: add --pre-glob flag
The --pre-glob flag is like the --glob flag, except it applies to filtering files through the preprocessor instead of for search. This makes it possible to apply the preprocessor to only a small subset of files, which can greatly reduce the process overhead of using a preprocessor when searching large directories.
This commit is contained in:
@@ -816,6 +816,24 @@ be, to a very large extent, the result of luck. Sherlock Holmes
|
||||
eqnice!(expected, cmd.stdout());
|
||||
});
|
||||
|
||||
rgtest!(preprocessing_glob, |dir: Dir, mut cmd: TestCommand| {
|
||||
if !cmd_exists("xzcat") {
|
||||
return;
|
||||
}
|
||||
|
||||
dir.create("sherlock", SHERLOCK);
|
||||
dir.create_bytes("sherlock.xz", include_bytes!("./data/sherlock.xz"));
|
||||
cmd.args(&["--pre", "xzcat", "--pre-glob", "*.xz", "Sherlock"]);
|
||||
|
||||
let expected = "\
|
||||
sherlock.xz:For the Doctor Watsons of this world, as opposed to the Sherlock
|
||||
sherlock.xz:be, to a very large extent, the result of luck. Sherlock Holmes
|
||||
sherlock:For the Doctor Watsons of this world, as opposed to the Sherlock
|
||||
sherlock:be, to a very large extent, the result of luck. Sherlock Holmes
|
||||
";
|
||||
eqnice!(sort_lines(expected), sort_lines(&cmd.stdout()));
|
||||
});
|
||||
|
||||
rgtest!(compressed_gzip, |dir: Dir, mut cmd: TestCommand| {
|
||||
if !cmd_exists("gzip") {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user