aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/client
diff options
context:
space:
mode:
authorSteven Xu <stevenxxiu@users.noreply.github.com>2023-03-27 01:44:06 +1100
committerGitHub <noreply@github.com>2023-03-26 15:44:06 +0100
commita7cb21a51b393b436c0ca7e09c892ebb3c597ad0 (patch)
treed55d1ad07d5d01ccac6f5100bf4d131da748537c /src/command/client
parentAdd musl build (#809) (diff)
downloadatuin-a7cb21a51b393b436c0ca7e09c892ebb3c597ad0.zip
feat: add *Nushell* support (#788)
* feat: add *Nushell* support * refactor: use `sh` to swap `STDOUT` and `STDERR` instead of using a temporary file * feat: include both keybindings, with the current REPL buffer passed to *Atuin*'s * feat: don't record commands run by keybindings
Diffstat (limited to 'src/command/client')
-rw-r--r--src/command/client/import.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/command/client/import.rs b/src/command/client/import.rs
index 7d7c2caf..7abc3d44 100644
--- a/src/command/client/import.rs
+++ b/src/command/client/import.rs
@@ -9,7 +9,8 @@ use atuin_client::{
database::Database,
history::History,
import::{
- bash::Bash, fish::Fish, resh::Resh, zsh::Zsh, zsh_histdb::ZshHistDb, Importer, Loader,
+ bash::Bash, fish::Fish, nu::Nu, nu_histdb::NuHistDb, resh::Resh, zsh::Zsh,
+ zsh_histdb::ZshHistDb, Importer, Loader,
},
};
@@ -29,6 +30,10 @@ pub enum Cmd {
Resh,
/// Import history from the fish history file
Fish,
+ /// Import history from the nu history file
+ Nu,
+ /// Import history from the nu history file
+ NuHistDb,
}
const BATCH_SIZE: usize = 100;
@@ -68,6 +73,17 @@ impl Cmd {
} else if shell.ends_with("/bash") {
println!("Detected Bash");
import::<Bash, DB>(db).await
+ } else if shell.ends_with("/nu") {
+ if NuHistDb::histpath().is_ok() {
+ println!(
+ "Detected Nu-HistDb, using :{}",
+ NuHistDb::histpath().unwrap().to_str().unwrap()
+ );
+ import::<NuHistDb, DB>(db).await
+ } else {
+ println!("Detected Nushell");
+ import::<Nu, DB>(db).await
+ }
} else {
println!("cannot import {shell} history");
Ok(())
@@ -79,6 +95,8 @@ impl Cmd {
Self::Bash => import::<Bash, DB>(db).await,
Self::Resh => import::<Resh, DB>(db).await,
Self::Fish => import::<Fish, DB>(db).await,
+ Self::Nu => import::<Nu, DB>(db).await,
+ Self::NuHistDb => import::<NuHistDb, DB>(db).await,
}
}
}