Include revision in status (#1166)

This commit is contained in:
Ellie Huxtable 2023-08-14 09:24:05 +01:00 committed by GitHub
parent 925bf0efaa
commit b207d0d9a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

10
atuin/build.rs Normal file
View File

@ -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);
}

View File

@ -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 {

View File

@ -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}