Skip to content

Commit

Permalink
allow BARK_PKG_VERSION to override CARGO_PKG_VERSION at compile time
Browse files Browse the repository at this point in the history
  • Loading branch information
haileys committed Dec 29, 2023
1 parent 0a555d4 commit 8ee86b9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use structopt::StructOpt;
use thiserror::Error;

#[derive(StructOpt)]
#[structopt(version = version())]
enum Opt {
Stream(stream::StreamOpt),
Receive(receive::ReceiveOpt),
Expand Down Expand Up @@ -68,3 +69,10 @@ fn default_log_level() -> LevelFilter {
LevelFilter::Info
}
}

const fn version() -> &'static str {
match option_env!("BARK_PKG_VERSION") {
Some(ver) => ver,
None => env!("CARGO_PKG_VERSION"),
}
}

0 comments on commit 8ee86b9

Please sign in to comment.