diff options
author | Andrew Gallant <jamslam@gmail.com> | 2020-03-15 10:06:23 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2020-03-15 13:19:14 -0400 |
commit | 12e41809850a4ac14ed200101ef8b033d2a20c38 (patch) | |
tree | d3f78ca44b96770f85fca31722223685e692a76e /crates | |
parent | daa831939873a50cd7e193a7211b5e3d37ad631c (diff) |
doc: remove CPU features from man pages
It doesn't really belong in the man page since it's an artifact of a
build/runtime configuration. Moreover, it inhibits reproducible builds.
Fixes #1441
Diffstat (limited to 'crates')
-rw-r--r-- | crates/core/app.rs | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/crates/core/app.rs b/crates/core/app.rs index ef9cf883..04bcf878 100644 --- a/crates/core/app.rs +++ b/crates/core/app.rs @@ -66,7 +66,7 @@ pub fn app() -> App<'static, 'static> { // 'static, but we need to build the version string dynamically. We can // fake the 'static lifetime with lazy_static. lazy_static! { - static ref LONG_VERSION: String = long_version(None); + static ref LONG_VERSION: String = long_version(None, true); } let mut app = App::new("ripgrep") @@ -91,30 +91,36 @@ pub fn app() -> App<'static, 'static> { /// If a revision hash is given, then it is used. If one isn't given, then /// the RIPGREP_BUILD_GIT_HASH env var is inspected for it. If that isn't set, /// then a revision hash is not included in the version string returned. -pub fn long_version(revision_hash: Option<&str>) -> String { +/// +/// If `cpu` is true, then the version string will include the compiled and +/// runtime CPU features. +pub fn long_version(revision_hash: Option<&str>, cpu: bool) -> String { // Do we have a git hash? // (Yes, if ripgrep was built on a machine with `git` installed.) let hash = match revision_hash.or(option_env!("RIPGREP_BUILD_GIT_HASH")) { None => String::new(), Some(githash) => format!(" (rev {})", githash), }; - // Put everything together. - let runtime = runtime_cpu_features(); - if runtime.is_empty() { - format!( - "{}{}\n{} (compiled)", - crate_version!(), - hash, - compile_cpu_features().join(" ") - ) + if !cpu { + format!("{}{}", crate_version!(), hash,) } else { - format!( - "{}{}\n{} (compiled)\n{} (runtime)", - crate_version!(), - hash, - compile_cpu_features().join(" "), - runtime.join(" ") - ) + let runtime = runtime_cpu_features(); + if runtime.is_empty() { + format!( + "{}{}\n{} (compiled)", + crate_version!(), + hash, + compile_cpu_features().join(" ") + ) + } else { + format!( + "{}{}\n{} (compiled)\n{} (runtime)", + crate_version!(), + hash, + compile_cpu_features().join(" "), + runtime.join(" ") + ) + } } } |