diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-04-25 18:21:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-25 17:21:52 +0000 |
| commit | 156893d774b4da5b541fdbb08428f9ec392949a0 (patch) | |
| tree | 9185d94384aa62eb6eb099ddc4ca9408df6f90d1 /src/command/mod.rs | |
| parent | Add to Cargo.toml (diff) | |
| download | atuin-156893d774b4da5b541fdbb08428f9ec392949a0.zip | |
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
Diffstat (limited to '')
| -rw-r--r-- | src/command/mod.rs | 42 |
1 files changed, 38 insertions, 4 deletions
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<String>, + #[structopt(long = "exclude-cwd", about = "exclude directory from results")] + exclude_cwd: Option<String>, + #[structopt(long, short, about = "filter search result by exit code")] exit: Option<i64>, + #[structopt(long = "exclude-exit", about = "exclude results with this exit code")] + exclude_exit: Option<i64>, + + #[structopt(long, short, about = "only include results added before this date")] + before: Option<String>, + + #[structopt(long, about = "only include results after this date")] + after: Option<String>, + #[structopt(long, short, about = "open interactive search UI")] interactive: bool, + #[structopt(long, short, about = "use human-readable formatting for time")] + human: bool, + query: Vec<String>, }, @@ -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), |
