aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/client/import.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/command/client/import.rs20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/command/client/import.rs b/src/command/client/import.rs
index 580e4b0e..60fd536d 100644
--- a/src/command/client/import.rs
+++ b/src/command/client/import.rs
@@ -8,7 +8,9 @@ use indicatif::ProgressBar;
use atuin_client::{
database::Database,
history::History,
- import::{bash::Bash, fish::Fish, resh::Resh, zsh::Zsh, Importer, Loader},
+ import::{
+ bash::Bash, fish::Fish, resh::Resh, zsh::Zsh, zsh_histdb::ZshHistDb, Importer, Loader,
+ },
};
#[derive(Parser)]
@@ -19,6 +21,8 @@ pub enum Cmd {
/// Import history from the zsh history file
Zsh,
+ /// Import history from the zsh history file
+ ZshHistDb,
/// Import history from the bash history file
Bash,
/// Import history from the resh history file
@@ -42,10 +46,17 @@ impl Cmd {
match self {
Self::Auto => {
let shell = env::var("SHELL").unwrap_or_else(|_| String::from("NO_SHELL"));
-
if shell.ends_with("/zsh") {
- println!("Detected ZSH");
- import::<Zsh, DB>(db).await
+ if ZshHistDb::histpath().is_ok() {
+ println!(
+ "Detected Zsh-HistDb, using :{}",
+ ZshHistDb::histpath().unwrap().to_str().unwrap()
+ );
+ import::<ZshHistDb, DB>(db).await
+ } else {
+ println!("Detected ZSH");
+ import::<Zsh, DB>(db).await
+ }
} else if shell.ends_with("/fish") {
println!("Detected Fish");
import::<Fish, DB>(db).await
@@ -59,6 +70,7 @@ impl Cmd {
}
Self::Zsh => import::<Zsh, DB>(db).await,
+ Self::ZshHistDb => import::<ZshHistDb, DB>(db).await,
Self::Bash => import::<Bash, DB>(db).await,
Self::Resh => import::<Resh, DB>(db).await,
Self::Fish => import::<Fish, DB>(db).await,