aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client/src/import/zsh_histdb.rs
diff options
context:
space:
mode:
Diffstat (limited to 'atuin-client/src/import/zsh_histdb.rs')
-rw-r--r--atuin-client/src/import/zsh_histdb.rs36
1 files changed, 19 insertions, 17 deletions
diff --git a/atuin-client/src/import/zsh_histdb.rs b/atuin-client/src/import/zsh_histdb.rs
index 2f9a192d..78a7176b 100644
--- a/atuin-client/src/import/zsh_histdb.rs
+++ b/atuin-client/src/import/zsh_histdb.rs
@@ -61,27 +61,29 @@ pub struct HistDbEntry {
impl From<HistDbEntry> for History {
fn from(histdb_item: HistDbEntry) -> Self {
- History::new(
- DateTime::from_utc(histdb_item.start_time, Utc), // must assume UTC?
- String::from_utf8(histdb_item.argv)
- .unwrap_or_else(|_e| String::from(""))
- .trim_end()
- .to_string(),
- String::from_utf8(histdb_item.dir)
- .unwrap_or_else(|_e| String::from(""))
- .trim_end()
- .to_string(),
- 0, // assume 0, we have no way of knowing :(
- histdb_item.duration,
- None,
- Some(
+ let imported = History::import()
+ .timestamp(DateTime::from_utc(histdb_item.start_time, Utc))
+ .command(
+ String::from_utf8(histdb_item.argv)
+ .unwrap_or_else(|_e| String::from(""))
+ .trim_end()
+ .to_string(),
+ )
+ .cwd(
+ String::from_utf8(histdb_item.dir)
+ .unwrap_or_else(|_e| String::from(""))
+ .trim_end()
+ .to_string(),
+ )
+ .duration(histdb_item.duration)
+ .hostname(
String::from_utf8(histdb_item.host)
.unwrap_or_else(|_e| String::from(""))
.trim_end()
.to_string(),
- ),
- None,
- )
+ );
+
+ imported.build().into()
}
}