aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/history.rs
diff options
context:
space:
mode:
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(())
+ }
}
}
}