summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-07-21 20:56:45 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-07-21 20:57:27 -0400
commit6dc09c5b1b7da5de65b5a5df3ce570f05d82e3a3 (patch)
tree53aeb457133bf4e5f09eec23fe70faef6e6df926
parent209a125ea25615e8fa605c844f8cbcca8c672208 (diff)
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.
-rw-r--r--src/app.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/app.rs b/src/app.rs
index 10e524b8..4336d5af 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -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);
}