aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/history.rs
diff options
context:
space:
mode:
authorEllie Huxtable <e@elm.sh>2021-03-20 00:50:31 +0000
committerGitHub <noreply@github.com>2021-03-20 00:50:31 +0000
commit716c7722cda29bf612508bb96f51822a86e0f69e (patch)
treefa3c4c192fc05b078397fcd510d39ae78e46abfa /src/command/history.rs
parentAdd config file support (#15) (diff)
downloadatuin-716c7722cda29bf612508bb96f51822a86e0f69e.zip
Add TUI, resolve #19, #17, #16 (#21)
Diffstat (limited to 'src/command/history.rs')
-rw-r--r--src/command/history.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/command/history.rs b/src/command/history.rs
index bd440163..af8aef7d 100644
--- a/src/command/history.rs
+++ b/src/command/history.rs
@@ -35,6 +35,12 @@ pub enum Cmd {
#[structopt(long, short)]
session: bool,
},
+
+ #[structopt(
+ about="search for a command",
+ aliases=&["se", "sea", "sear", "searc"],
+ )]
+ Search { query: Vec<String> },
}
fn print_list(h: &[History]) {
@@ -102,6 +108,13 @@ impl Cmd {
Ok(())
}
+
+ Self::Search { query } => {
+ let history = db.prefix_search(&query.join(""))?;
+ print_list(&history);
+
+ Ok(())
+ }
}
}
}