Skip to content

Commit

Permalink
Add build version (commit) info
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed Feb 19, 2024
1 parent 2b9027d commit ba36aad
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 1 deletion.
191 changes: 191 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ humansize = "2.1.3"
console = { version = "0.15", default-features = false, features = ["ansi-parsing"] }
apt-parser = "1.0.0"
flate2 = "1.0.28"
shadow-rs = "0.26.1"

[build-dependencies]
shadow-rs = "0.26.1"

[dev-dependencies]
test-log = { version = "0.2.14", default-features = false, features = ["trace"] }
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() -> shadow_rs::SdResult<()> {
shadow_rs::new()
}
9 changes: 8 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ use parser::ParserType;
use tracing_subscriber::EnvFilter;
use url::Url;

use shadow_rs::shadow;
shadow!(build);

mod cli;
mod compare;
mod listing;
Expand All @@ -20,8 +23,9 @@ mod extensions;
use crate::regex_process::ExpandedRegex;

#[derive(Parser, Debug)]
#[command(about, version)]
#[command(about)]
#[command(propagate_version = true)]
#[command(version = build::SHORT_COMMIT)]
struct Cli {
#[command(subcommand)]
command: Commands,
Expand Down Expand Up @@ -155,6 +159,9 @@ fn main() {
.with_ansi(enable_color)
.init();

// Print version info in debug mode
tracing::debug!("{}", build::CLAP_LONG_VERSION);

let bind_address = match std::env::var("BIND_ADDRESS").ok() {
Some(s) => {
let s = s.trim();
Expand Down

0 comments on commit ba36aad

Please sign in to comment.