summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordana <dana@dana.is>2017-07-07 10:30:59 -0500
committerAndrew Gallant <jamslam@gmail.com>2017-07-07 11:30:59 -0400
commitad262f114623679f701bb836996977fc57f5dd91 (patch)
treeb8546d7103ef39233dace2c9b76c21de023e3e73
parent170c078440b02a3fed1ed1d5c3723491ea83fb9b (diff)
Update `--version` output to show compile-time features
Fixes #524
-rw-r--r--src/app.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/app.rs b/src/app.rs
index 832ac6ea..52d9d28d 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -50,6 +50,7 @@ pub fn app() -> App<'static, 'static> {
App::new("ripgrep")
.author(crate_authors!())
.version(crate_version!())
+ .long_version(LONG_VERSION.as_str())
.about(ABOUT)
.max_term_width(100)
.setting(AppSettings::UnifiedHelpMessage)
@@ -194,6 +195,24 @@ macro_rules! doc {
}
lazy_static! {
+ static ref LONG_VERSION: String = {
+ let mut features: Vec<&str> = vec![];
+
+ if cfg!(feature = "avx-accel") {
+ features.push("+avx-accel");
+ } else {
+ features.push("-avx-accel");
+ }
+
+ if cfg!(feature = "simd-accel") {
+ features.push("+simd-accel");
+ } else {
+ features.push("-simd-accel");
+ }
+
+ format!("{}, with features (+/-): {}", crate_version!(), features.join(" "))
+ };
+
static ref USAGES: HashMap<&'static str, Usage> = {
let mut h = HashMap::new();
doc!(h, "help-short",