diff options
Diffstat (limited to 'crates/atuin-client/src/import')
| -rw-r--r-- | crates/atuin-client/src/import/replxx.rs | 19 | ||||
| -rw-r--r-- | crates/atuin-client/src/import/zsh.rs | 4 |
2 files changed, 19 insertions, 4 deletions
diff --git a/crates/atuin-client/src/import/replxx.rs b/crates/atuin-client/src/import/replxx.rs index dd7030ad..47d566cf 100644 --- a/crates/atuin-client/src/import/replxx.rs +++ b/crates/atuin-client/src/import/replxx.rs @@ -19,8 +19,23 @@ fn default_histpath() -> Result<PathBuf> { let home_dir = user_dirs.home_dir(); // There is no default histfile for replxx. - // For simplicity let's use the most common one. - Ok(home_dir.join(".histfile")) + // Here we try a couple of common names. + let mut candidates = ["replxx_history.txt", ".histfile"].iter(); + loop { + match candidates.next() { + Some(candidate) => { + let histpath = home_dir.join(candidate); + if histpath.exists() { + break Ok(histpath); + } + } + None => { + break Err(eyre!( + "Could not find history file. Try setting and exporting $HISTFILE" + )); + } + } + } } #[async_trait] diff --git a/crates/atuin-client/src/import/zsh.rs b/crates/atuin-client/src/import/zsh.rs index b65e2608..11e2f371 100644 --- a/crates/atuin-client/src/import/zsh.rs +++ b/crates/atuin-client/src/import/zsh.rs @@ -70,7 +70,7 @@ impl Importer for Zsh { if let Some(s) = s.strip_suffix('\\') { line.push_str(s); - line.push_str("\\\n"); + line.push('\n'); } else { line.push_str(&s); let command = std::mem::take(&mut line); @@ -188,7 +188,7 @@ mod test { #[tokio::test] async fn test_parse_file() { let bytes = r": 1613322469:0;cargo install atuin -: 1613322469:10;cargo install atuin; \ +: 1613322469:10;cargo install atuin; \\ cargo update : 1613322469:10;cargo :b̷i̶t̴r̵o̴t̴ ̵i̷s̴ ̷r̶e̵a̸l̷ " |
