mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-10 07:08:05 -05:00
darkirc: append commit hash to --version output
This commit is contained in:
@@ -16,7 +16,20 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let output = Command::new("git")
|
||||
.args(["rev-parse", "--short", "HEAD"])
|
||||
.output();
|
||||
|
||||
if let Ok(output) = output {
|
||||
if output.status.success() {
|
||||
let commitish = String::from_utf8_lossy(&output.stdout);
|
||||
println!("cargo:rustc-env=COMMITISH={}", commitish.trim());
|
||||
}
|
||||
}
|
||||
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "android" {
|
||||
println!("cargo:rustc-link-search={}/sqlcipher", env!("CARGO_MANIFEST_DIR"));
|
||||
}
|
||||
|
||||
@@ -66,7 +66,11 @@ fn panic_hook(panic_info: &std::panic::PanicHookInfo) {
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
|
||||
#[serde(default)]
|
||||
#[structopt(name = "darkirc", about = cli_desc!())]
|
||||
#[structopt(
|
||||
name = "darkirc",
|
||||
about = cli_desc!(),
|
||||
version = concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMITISH"))
|
||||
)]
|
||||
struct Args {
|
||||
#[structopt(short, parse(from_occurrences))]
|
||||
/// Increase verbosity (-vvv supported)
|
||||
|
||||
@@ -63,10 +63,15 @@ pub const ANSI_LOGO: &str = include_str!("../contrib/darkfi.ansi");
|
||||
#[macro_export]
|
||||
macro_rules! cli_desc {
|
||||
() => {{
|
||||
let commitish = match option_env!("COMMITISH") {
|
||||
Some(c) => &format!("-{}", c),
|
||||
None => ""
|
||||
};
|
||||
let desc = format!(
|
||||
"{} {}\n{}\n{}",
|
||||
"{} {}\n{}{}\n{}",
|
||||
env!("CARGO_PKG_NAME").to_string(),
|
||||
env!("CARGO_PKG_VERSION").to_string(),
|
||||
commitish,
|
||||
env!("CARGO_PKG_DESCRIPTION").to_string(),
|
||||
darkfi::ANSI_LOGO,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user