From 72c5ea79147f7bd486839cfeb4aab62a98a0bdd2 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Sun, 14 Feb 2021 17:18:02 +0000 Subject: tidy some stuff (#6) --- src/command/history.rs | 6 +++--- src/command/mod.rs | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'src/command') diff --git a/src/command/history.rs b/src/command/history.rs index 5959fc55..e40af4d6 100644 --- a/src/command/history.rs +++ b/src/command/history.rs @@ -34,7 +34,7 @@ pub enum Cmd { }, } -fn print_list(h: &Vec) { +fn print_list(h: &[History]) { for i in h { println!("{}", i.command); } @@ -60,7 +60,7 @@ impl Cmd { // print the ID // we use this as the key for calling end println!("{}", h.id); - db.save(h)?; + db.save(&h)?; Ok(()) } @@ -69,7 +69,7 @@ impl Cmd { h.exit = *exit; h.duration = chrono::Utc::now().timestamp_nanos() - h.timestamp; - db.update(h)?; + db.update(&h)?; Ok(()) } diff --git a/src/command/mod.rs b/src/command/mod.rs index 5c36146a..8d463bd6 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -1,3 +1,23 @@ -pub mod history; -pub mod import; -pub mod server; +use structopt::StructOpt; + +mod history; +mod import; +mod server; + +#[derive(StructOpt)] +pub enum AtuinCmd { + #[structopt( + about="manipulate shell history", + aliases=&["h", "hi", "his", "hist", "histo", "histor"], + )] + History(history::Cmd), + + #[structopt(about = "import shell history from file")] + Import(import::Cmd), + + #[structopt(about = "start an atuin server")] + Server(server::Cmd), + + #[structopt(about = "generates a UUID")] + Uuid, +} -- cgit v1.3.1