diff options
Diffstat (limited to 'src/local/history.rs')
-rw-r--r-- | src/local/history.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/local/history.rs b/src/local/history.rs index 0ca112bd..1712f8b9 100644 --- a/src/local/history.rs +++ b/src/local/history.rs @@ -1,12 +1,15 @@ use std::env; use std::hash::{Hash, Hasher}; +use chrono::Utc; + use crate::command::uuid_v4; -#[derive(Debug, Clone)] +// Any new fields MUST be Optional<>! +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct History { pub id: String, - pub timestamp: i64, + pub timestamp: chrono::DateTime<Utc>, pub duration: i64, pub exit: i64, pub command: String, @@ -17,7 +20,7 @@ pub struct History { impl History { pub fn new( - timestamp: i64, + timestamp: chrono::DateTime<Utc>, command: String, cwd: String, exit: i64, @@ -29,7 +32,7 @@ impl History { .or_else(|| env::var("ATUIN_SESSION").ok()) .unwrap_or_else(uuid_v4); let hostname = - hostname.unwrap_or_else(|| hostname::get().unwrap().to_str().unwrap().to_string()); + hostname.unwrap_or_else(|| format!("{}:{}", whoami::hostname(), whoami::username())); Self { id: uuid_v4(), |