Skip to content

Commit 5996c4a

Browse files
authored
Merge branch 'develop' into chore/move-signer-logs-to-info
2 parents 54c6bee + 409fb28 commit 5996c4a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

stacks-signer/src/cli.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use clarity::util::hash::Sha256Sum;
2929
use clarity::util::secp256k1::MessageSignature;
3030
use clarity::vm::types::{QualifiedContractIdentifier, TupleData};
3131
use clarity::vm::Value;
32+
use lazy_static::lazy_static;
3233
use serde::{Deserialize, Serialize};
3334
use stacks_common::address::{
3435
b58, AddressHashMode, C32_ADDRESS_VERSION_MAINNET_MULTISIG,
@@ -40,8 +41,34 @@ use stacks_common::types::chainstate::StacksPrivateKey;
4041

4142
extern crate alloc;
4243

44+
const GIT_BRANCH: Option<&'static str> = option_env!("GIT_BRANCH");
45+
const GIT_COMMIT: Option<&'static str> = option_env!("GIT_COMMIT");
46+
#[cfg(debug_assertions)]
47+
const BUILD_TYPE: &'static str = "debug";
48+
#[cfg(not(debug_assertions))]
49+
const BUILD_TYPE: &'static str = "release";
50+
51+
lazy_static! {
52+
static ref VERSION_STRING: String = {
53+
let pkg_version = option_env!("STACKS_NODE_VERSION").unwrap_or(env!("CARGO_PKG_VERSION"));
54+
let git_branch = GIT_BRANCH.unwrap_or("");
55+
let git_commit = GIT_COMMIT.unwrap_or("");
56+
format!(
57+
"{} ({}:{}, {} build, {} [{}])",
58+
pkg_version,
59+
git_branch,
60+
git_commit,
61+
BUILD_TYPE,
62+
std::env::consts::OS,
63+
std::env::consts::ARCH
64+
)
65+
};
66+
}
67+
4368
#[derive(Parser, Debug)]
4469
#[command(author, version, about)]
70+
#[command(long_version = VERSION_STRING.as_str())]
71+
4572
/// The CLI arguments for the stacks signer
4673
pub struct Cli {
4774
/// Subcommand action to take

0 commit comments

Comments
 (0)