Skip to content

Commit

Permalink
Omit 'packetcrypt-' when printing version
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdelisle committed Jul 2, 2021
1 parent 122d2b6 commit cc8fd25
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>")
.about("Bandwidth hard proof of work algorithm")
.setting(clap::AppSettings::ArgRequiredElseHelp)
Expand Down

0 comments on commit cc8fd25

Please sign in to comment.