1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-04-14 00:58:43 +02:00

ripgrep: add --no-pre switch

This switch explicitly disables the --pre behavior. An empty string will
also disable --pre behavior, but actually utterring an empty flag value
is quite awkward, so we provide an explicit switch to do the same thing.

Thanks to @c-blake for pointing this out.
This commit is contained in:
Andrew Gallant 2018-07-21 20:56:45 -04:00
parent 209a125ea2
commit 6dc09c5b1b
No known key found for this signature in database
GPG Key ID: B2E3A4923F8B0D44

View File

@ -1460,8 +1460,7 @@ This flag can be disabled with --no-search-zip.
let arg = RGArg::switch("no-search-zip")
.hidden()
.overrides("search-zip")
.overrides("pre");
.overrides("search-zip");
args.push(arg);
}
@ -1470,8 +1469,8 @@ fn flag_pre(args: &mut Vec<RGArg>) {
const LONG: &str = long!("\
For each input FILE, search the standard output of COMMAND FILE rather than the
contents of FILE. This option expects the COMMAND program to either be an
absolute path or to be available in your PATH. An empty string COMMAND
deactivates this feature.
absolute path or to be available in your PATH. Either an empty string COMMAND
or the `--no-pre` flag will disable this behavior.
WARNING: When this flag is set, ripgrep will unconditionally spawn a
process for every file that is searched. Therefore, this can incur an
@ -1513,8 +1512,13 @@ This overrides the -z/--search-zip flag.
");
let arg = RGArg::flag("pre", "COMMAND")
.help(SHORT).long_help(LONG)
.overrides("search-zip")
.overrides("no-search-zip");
.overrides("no-pre")
.overrides("search-zip");
args.push(arg);
let arg = RGArg::switch("no-pre")
.hidden()
.overrides("pre");
args.push(arg);
}