diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-02-13 20:21:49 +0000 |
|---|---|---|
| committer | Ellie Huxtable <e@elm.sh> | 2021-02-13 20:24:22 +0000 |
| commit | 440c4fc2335d5286d14367e39c99bb4946efe9e3 (patch) | |
| tree | 766f33c9c6b87998f22bc146fe7361e798b377df /src/command | |
| parent | Implement history import (diff) | |
| download | atuin-440c4fc2335d5286d14367e39c99bb4946efe9e3.zip | |
Add sessions
Diffstat (limited to '')
| -rw-r--r-- | src/command/history.rs | 12 | ||||
| -rw-r--r-- | src/command/import.rs | 13 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/command/history.rs b/src/command/history.rs index 72f821c5..4caf4c17 100644 --- a/src/command/history.rs +++ b/src/command/history.rs @@ -32,13 +32,21 @@ pub enum HistoryCmd { } impl HistoryCmd { - pub fn run(&self, db: SqliteDatabase) -> Result<()> { + pub fn run(&self, db: &mut SqliteDatabase) -> Result<()> { match self { HistoryCmd::Start { command: words } => { let command = words.join(" "); let cwd = env::current_dir()?.display().to_string(); - let h = History::new(chrono::Utc::now().timestamp_nanos(), command, cwd, -1, -1); + let h = History::new( + chrono::Utc::now().timestamp_nanos(), + command, + cwd, + -1, + -1, + None, + None, + ); // print the ID // we use this as the key for calling end diff --git a/src/command/import.rs b/src/command/import.rs index 5ece13a8..5ce0e749 100644 --- a/src/command/import.rs +++ b/src/command/import.rs @@ -87,12 +87,23 @@ impl ImportCmd { } pub fn run(&self, db: &mut SqliteDatabase) -> Result<()> { + println!(" A'Tuin "); + println!("====================="); + println!(" 🌍 "); + println!(" 🐘🐘🐘🐘 "); + println!(" 🐢 "); + println!("====================="); + println!("Importing history..."); + match self { ImportCmd::Auto => { let shell = env::var("SHELL").unwrap_or(String::from("NO_SHELL")); match shell.as_str() { - "/bin/zsh" => self.import_zsh(db), + "/bin/zsh" => { + println!("Detected ZSH"); + self.import_zsh(db) + } _ => { println!("cannot import {} history", shell); |
