diff --git a/atuin/build.rs b/atuin/build.rs new file mode 100644 index 00000000..06df6463 --- /dev/null +++ b/atuin/build.rs @@ -0,0 +1,10 @@ +use std::process::Command; +fn main() { + let output = Command::new("git") + .args(["rev-parse", "HEAD"]) + .output() + .unwrap(); + + let git_hash = String::from_utf8(output.stdout).unwrap(); + println!("cargo:rustc-env=GIT_HASH={}", git_hash); +} diff --git a/atuin/src/command/client/sync/status.rs b/atuin/src/command/client/sync/status.rs index e0d45cad..b4aa3b71 100644 --- a/atuin/src/command/client/sync/status.rs +++ b/atuin/src/command/client/sync/status.rs @@ -1,3 +1,4 @@ +use crate::{SHA, VERSION}; use atuin_client::{api_client, database::Database, settings::Settings}; use colored::Colorize; use eyre::Result; @@ -9,6 +10,8 @@ pub async fn run(settings: &Settings, db: &impl Database) -> Result<()> { let last_sync = Settings::last_sync()?; let local_count = db.history_count().await?; + println!("Atuin v{VERSION} - Build rev {SHA}\n"); + println!("{}", "[Local]".green()); if settings.auto_sync { diff --git a/atuin/src/main.rs b/atuin/src/main.rs index 2f81f4fc..8a00177a 100644 --- a/atuin/src/main.rs +++ b/atuin/src/main.rs @@ -8,6 +8,7 @@ use command::AtuinCmd; mod command; const VERSION: &str = env!("CARGO_PKG_VERSION"); +const SHA: &str = env!("GIT_HASH"); static HELP_TEMPLATE: &str = "\ {before-help}{name} {version}