summaryrefslogtreecommitdiffstats
path: root/src/app.rs
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2019-04-14 16:46:02 -0400
committerAndrew Gallant <jamslam@gmail.com>2019-04-14 19:29:27 -0400
commitda9d7204315164e3740099aac4a4b88fb743e4d5 (patch)
tree5a03ef6a3f619ece2f7a9433f4d73c3885572075 /src/app.rs
parenta9d71a03680ac9c7b0b26ce6b0570145e7e2e2de (diff)
ripgrep: add --pcre2-version flag
This flag will output details about the version of PCRE2 that ripgrep is using (if any).
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/app.rs b/src/app.rs
index c410b5fd..b102d7cd 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -605,6 +605,7 @@ pub fn all_args_and_flags() -> Vec<RGArg> {
flag_path_separator(&mut args);
flag_passthru(&mut args);
flag_pcre2(&mut args);
+ flag_pcre2_version(&mut args);
flag_pre(&mut args);
flag_pre_glob(&mut args);
flag_pretty(&mut args);
@@ -651,7 +652,7 @@ will be provided. Namely, the following is equivalent to the above:
let arg = RGArg::positional("pattern", "PATTERN")
.help(SHORT).long_help(LONG)
.required_unless(&[
- "file", "files", "regexp", "type-list",
+ "file", "files", "regexp", "type-list", "pcre2-version",
]);
args.push(arg);
}
@@ -1946,6 +1947,18 @@ This flag can be disabled with --no-pcre2.
args.push(arg);
}
+fn flag_pcre2_version(args: &mut Vec<RGArg>) {
+ const SHORT: &str = "Print the version of PCRE2 that ripgrep uses.";
+ const LONG: &str = long!("\
+When this flag is present, ripgrep will print the version of PCRE2 in use,
+along with other information, and then exit. If PCRE2 is not available, then
+ripgrep will print an error message and exit with an error code.
+");
+ let arg = RGArg::switch("pcre2-version")
+ .help(SHORT).long_help(LONG);
+ args.push(arg);
+}
+
fn flag_pre(args: &mut Vec<RGArg>) {
const SHORT: &str = "search outputs of COMMAND FILE for each FILE";
const LONG: &str = long!("\