Skip to content

Commit

Permalink
feat: add commit hash from build to version return on CLI (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuajbouw committed May 16, 2023
1 parent c5b4090 commit bea7b4c
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 1 deletion.
132 changes: 132 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ bs58 = "0.4.0"
clap = { version = "4", features = ["derive"] }
ethabi = "18"
hex = "0.4.3"
lazy_static = "1.4.0"
libsecp256k1 = { version = "0.7", features = ["std"] }
near-chain-configs = "0.16"
near-crypto = "0.16"
Expand All @@ -42,8 +43,12 @@ rand = "0.8"
rlp = "0.5.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
shadow-rs = "0.21.0"
thiserror = "1"
tokio = { version = "1", features = ["full"] }

[dev-dependencies]
rand = "0.8"

[build-dependencies]
shadow-rs = "0.21.0"
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()
}
16 changes: 15 additions & 1 deletion src/cli/simple/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
use clap::{Parser, Subcommand};
use lazy_static::lazy_static;
use shadow_rs::shadow;
use std::str::FromStr;

pub mod command;

lazy_static! {
static ref VERSION: String = {
shadow!(build);
format!("{}-{}", build::PKG_VERSION, build::SHORT_COMMIT)
};
}

fn get_version() -> &'static str {
VERSION.as_str()
}

/// Simple command line interface for communication with Aurora Engine
#[derive(Parser)]
#[command(author, version, long_about = None)]
#[command(author, long_about = None)]
#[command(version = get_version())]
pub struct Cli {
/// NEAR network ID
#[arg(long, default_value = "localnet")]
Expand Down

0 comments on commit bea7b4c

Please sign in to comment.