Skip to content

Commit fe15154

Browse files
committed
feat: support additional history filenames in replxx importer
1 parent 0f05e0e commit fe15154

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

crates/atuin-client/src/import/replxx.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,23 @@ fn default_histpath() -> Result<PathBuf> {
1919
let home_dir = user_dirs.home_dir();
2020

2121
// There is no default histfile for replxx.
22-
// For simplicity let's use the most common one.
23-
Ok(home_dir.join(".histfile"))
22+
// Here we try a couple of common names.
23+
let mut candidates = ["replxx_history.txt", ".histfile"].iter();
24+
loop {
25+
match candidates.next() {
26+
Some(candidate) => {
27+
let histpath = home_dir.join(candidate);
28+
if histpath.exists() {
29+
break Ok(histpath);
30+
}
31+
}
32+
None => {
33+
break Err(eyre!(
34+
"Could not find history file. Try setting and exporting $HISTFILE"
35+
));
36+
}
37+
}
38+
}
2439
}
2540

2641
#[async_trait]

0 commit comments

Comments
 (0)