aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/history
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-20 23:00:06 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-20 23:00:06 +0200
commit2f671f196e245ac1a791c001286e401a2fab9d3a (patch)
treebe90d8f16d5c8b65c6b77ebe1359d22e9738bbf6 /crates/turtle/src/history
parentchore: Commit (diff)
downloadatuin-2f671f196e245ac1a791c001286e401a2fab9d3a.zip
chore: Commit
Diffstat (limited to 'crates/turtle/src/history')
-rw-r--r--crates/turtle/src/history/builder.rs4
-rw-r--r--crates/turtle/src/history/mod.rs24
2 files changed, 4 insertions, 24 deletions
diff --git a/crates/turtle/src/history/builder.rs b/crates/turtle/src/history/builder.rs
index 7eca0491..08d26f7f 100644
--- a/crates/turtle/src/history/builder.rs
+++ b/crates/turtle/src/history/builder.rs
@@ -68,8 +68,8 @@ impl From<HistoryDaemonCapture> for History {
captured.cwd,
-1,
-1,
- Some(captured.session),
- Some(captured.hostname),
+ captured.session,
+ captured.hostname,
captured.author,
captured.intent,
None,
diff --git a/crates/turtle/src/history/mod.rs b/crates/turtle/src/history/mod.rs
index 10e74d8e..27755bbe 100644
--- a/crates/turtle/src/history/mod.rs
+++ b/crates/turtle/src/history/mod.rs
@@ -30,22 +30,6 @@ impl From<String> for HistoryId {
}
}
-pub(crate) fn get_hostname() -> String {
- env::var("ATUIN_HOST_NAME")
- .unwrap_or_else(|_| whoami::hostname().unwrap_or_else(|_| "unknown-host".to_string()))
-}
-
-pub(crate) fn get_username() -> String {
- env::var("ATUIN_HOST_USER")
- .unwrap_or_else(|_| whoami::username().unwrap_or_else(|_| "unknown-user".to_string()))
-}
-
-/// Returns a pair of the hostname and username, separated by a colon.
-#[must_use]
-pub fn get_host_user() -> String {
- format!("{}:{}", get_hostname(), get_username())
-}
-
/// Client-side history entry.
///
/// Client stores data unencrypted, and only encrypts it before sending to the server.
@@ -123,16 +107,12 @@ impl History {
cwd: String,
exit: i64,
duration: i64,
- session: Option<String>,
- hostname: Option<String>,
+ session: String,
+ hostname: String,
author: Option<String>,
intent: Option<String>,
deleted_at: Option<OffsetDateTime>,
) -> Self {
- let session = session
- .or_else(|| env::var("ATUIN_SESSION").ok())
- .unwrap_or_else(|| uuid_v7().as_simple().to_string());
- let hostname = hostname.unwrap_or_else(get_host_user);
let author = Self::normalize_optional_field(author)
.or_else(|| Self::normalize_optional_field(env::var(HISTORY_AUTHOR_ENV).ok()))
.unwrap_or_else(|| Self::author_from_hostname(hostname.as_str()));