From 156893d774b4da5b541fdbb08428f9ec392949a0 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Sun, 25 Apr 2021 18:21:52 +0100 Subject: Update docs, unify on SQLx, bugfixes (#40) * Begin moving to sqlx for local too * Stupid scanners should just have a nice cup of tea Random internet shit searching for /.env or whatever * Remove diesel and rusqlite fully --- src/command/mod.rs | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'src/command/mod.rs') diff --git a/src/command/mod.rs b/src/command/mod.rs index 805ad9f0..78e6402e 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -47,12 +47,27 @@ pub enum AtuinCmd { #[structopt(long, short, about = "filter search result by directory")] cwd: Option, + #[structopt(long = "exclude-cwd", about = "exclude directory from results")] + exclude_cwd: Option, + #[structopt(long, short, about = "filter search result by exit code")] exit: Option, + #[structopt(long = "exclude-exit", about = "exclude results with this exit code")] + exclude_exit: Option, + + #[structopt(long, short, about = "only include results added before this date")] + before: Option, + + #[structopt(long, about = "only include results after this date")] + after: Option, + #[structopt(long, short, about = "open interactive search UI")] interactive: bool, + #[structopt(long, short, about = "use human-readable formatting for time")] + human: bool, + query: Vec, }, @@ -79,20 +94,39 @@ impl AtuinCmd { let db_path = PathBuf::from(client_settings.db_path.as_str()); - let mut db = Sqlite::new(db_path)?; + let mut db = Sqlite::new(db_path).await?; match self { Self::History(history) => history.run(&client_settings, &mut db).await, - Self::Import(import) => import.run(&mut db), + Self::Import(import) => import.run(&mut db).await, Self::Server(server) => server.run(&server_settings).await, - Self::Stats(stats) => stats.run(&mut db, &client_settings), + Self::Stats(stats) => stats.run(&mut db, &client_settings).await, Self::Init => init::init(), Self::Search { cwd, exit, interactive, + human, + exclude_exit, + exclude_cwd, + before, + after, query, - } => search::run(cwd, exit, interactive, &query, &mut db), + } => { + search::run( + cwd, + exit, + interactive, + human, + exclude_exit, + exclude_cwd, + before, + after, + &query, + &mut db, + ) + .await + } Self::Sync { force } => sync::run(&client_settings, force, &mut db).await, Self::Login(l) => l.run(&client_settings), -- cgit v1.3.1