From cc8fd2561703586e42168a1e730ff4225bc14ad5 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Fri, 2 Jul 2021 04:22:30 +0200 Subject: [PATCH] Omit 'packetcrypt-' when printing version --- src/main.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 71e01ed..8fb0716 100644 --- a/src/main.rs +++ b/src/main.rs @@ -267,18 +267,20 @@ async fn async_main(matches: clap::ArgMatches<'_>) -> Result<()> { Ok(()) } -// const fn version() -> &'static str { -// let v = git_version::git_version!(); -// if v == -// git_version::git_version!(args = ["--tags"]); -// &"hi" -// } +fn version() -> &'static str { + let out = git_version::git_version!(args = ["--tags", "--dirty=-dirty"]); + if out.starts_with("packetcrypt-") { + &out["packetcrypt-".len()..] + } else { + &out + } +} #[tokio::main] async fn main() -> Result<()> { let cpus_str = format!("{}", num_cpus::get()); let matches = App::new("packetcrypt") - .version(git_version::git_version!(args = ["--tags", "--dirty=-dirty"])) + .version(version()) .author("Caleb James DeLisle ") .about("Bandwidth hard proof of work algorithm") .setting(clap::AppSettings::ArgRequiredElseHelp)