aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Trzesniewski <lucas.trzesniewski@gmail.com>2025-10-20 20:27:03 +0200
committerGitHub <noreply@github.com>2025-10-20 11:27:03 -0700
commit10ab94372b2f2ae56a2822c6ce31f3fd1854eb41 (patch)
treea96120706bb3954db249c91d0e4f0066b01861f2
parentchore(release): prepare for release 18.9.0 (#2952) (diff)
downloadatuin-10ab94372b2f2ae56a2822c6ce31f3fd1854eb41.zip
feat: add commit to displayed version info (#2922)
This adds the commit SHA to the following: - `atuin doctor` - `atuin info` (which already displays the version) - `atuin --version` (but not `atuin -V` in order not to affect `atuin --help`) I'm submitting this because I had issue reports in #2543 which were already resolved, so being able to easily ask for the commit id would have been helpful, as the version number isn't meaningful in a PR. Also, I suppose the info should have been included in `atuin doctor` in the first place, so that probably fixes an oversight. ## Checks - [x] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [x] I have checked that there are no existing pull requests for the same thing
-rw-r--r--crates/atuin/src/command/client/doctor.rs2
-rw-r--r--crates/atuin/src/command/client/info.rs4
-rw-r--r--crates/atuin/src/main.rs3
3 files changed, 7 insertions, 2 deletions
diff --git a/crates/atuin/src/command/client/doctor.rs b/crates/atuin/src/command/client/doctor.rs
index 83d9e84c..975b4cf3 100644
--- a/crates/atuin/src/command/client/doctor.rs
+++ b/crates/atuin/src/command/client/doctor.rs
@@ -296,6 +296,7 @@ impl SettingPaths {
#[derive(Debug, Serialize)]
struct AtuinInfo {
pub version: String,
+ pub commit: String,
/// Whether the main Atuin sync server is in use
/// I'm just calling it Atuin Cloud for lack of a better name atm
@@ -328,6 +329,7 @@ impl AtuinInfo {
Self {
version: crate::VERSION.to_string(),
+ commit: crate::SHA.to_string(),
sync,
sqlite_version,
setting_paths: SettingPaths::new(settings),
diff --git a/crates/atuin/src/command/client/info.rs b/crates/atuin/src/command/client/info.rs
index 60ba1fe6..efc107e3 100644
--- a/crates/atuin/src/command/client/info.rs
+++ b/crates/atuin/src/command/client/info.rs
@@ -1,6 +1,6 @@
use atuin_client::settings::Settings;
-use crate::VERSION;
+use crate::{SHA, VERSION};
pub fn run(settings: &Settings) {
let config = atuin_common::utils::config_dir();
@@ -23,7 +23,7 @@ pub fn run(settings: &Settings) {
std::env::var("ATUIN_CONFIG_DIR").unwrap_or_else(|_| "None".into())
);
- let general_info = format!("Version info:\nversion: {VERSION}");
+ let general_info = format!("Version info:\nversion: {VERSION}\ncommit: {SHA}");
let print_out = format!("{config_paths}\n\n{env_vars}\n\n{general_info}");
diff --git a/crates/atuin/src/main.rs b/crates/atuin/src/main.rs
index eaa58664..8b6947e3 100644
--- a/crates/atuin/src/main.rs
+++ b/crates/atuin/src/main.rs
@@ -14,6 +14,8 @@ mod sync;
const VERSION: &str = env!("CARGO_PKG_VERSION");
const SHA: &str = env!("GIT_HASH");
+const LONG_VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), " (", env!("GIT_HASH"), ")");
+
static HELP_TEMPLATE: &str = "\
{before-help}{name} {version}
{author}
@@ -29,6 +31,7 @@ static HELP_TEMPLATE: &str = "\
#[command(
author = "Ellie Huxtable <ellie@atuin.sh>",
version = VERSION,
+ long_version = LONG_VERSION,
help_template(HELP_TEMPLATE),
)]
struct Atuin {