diff options
| author | Vladislav Stepanov <8uk.8ak@gmail.com> | 2023-04-14 23:18:58 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-14 20:18:58 +0100 |
| commit | c05d2850420a2c163b8f62c33a6cef7c0ae1ad8d (patch) | |
| tree | 2c44a44eda7e76fa74e78ac1fd02f55c1ed4d804 /src/command/client.rs | |
| parent | Switch to uuidv7 (#864) (diff) | |
| download | atuin-c05d2850420a2c163b8f62c33a6cef7c0ae1ad8d.zip | |
Workspace reorder (#868)
* Try different workspace structure
Move main crate (atuin) to be on the same level with other crates in
this workspace
* extract common dependencies to the workspace definition
* fix base64 v0.21 deprecation warning
* questionable: update deps & fix chrono deprecations
possible panic sites are unchanged, they're just more visible now
* Revert "questionable: update deps & fix chrono deprecations"
This reverts commit 993e60f8dea81a1625a04285a617959ad09a0866.
Diffstat (limited to 'src/command/client.rs')
| -rw-r--r-- | src/command/client.rs | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/command/client.rs b/src/command/client.rs deleted file mode 100644 index 2a825638..00000000 --- a/src/command/client.rs +++ /dev/null @@ -1,61 +0,0 @@ -use std::path::PathBuf; - -use clap::Subcommand; -use eyre::{Result, WrapErr}; - -use atuin_client::{database::Sqlite, settings::Settings}; -use env_logger::Builder; - -#[cfg(feature = "sync")] -mod sync; - -mod history; -mod import; -mod search; -mod stats; - -#[derive(Subcommand)] -#[command(infer_subcommands = true)] -pub enum Cmd { - /// Manipulate shell history - #[command(subcommand)] - History(history::Cmd), - - /// Import shell history from file - #[command(subcommand)] - Import(import::Cmd), - - /// Calculate statistics for your history - Stats(stats::Cmd), - - /// Interactive history search - Search(search::Cmd), - - #[cfg(feature = "sync")] - #[command(flatten)] - Sync(sync::Cmd), -} - -impl Cmd { - #[tokio::main(flavor = "current_thread")] - pub async fn run(self) -> Result<()> { - Builder::new() - .filter_level(log::LevelFilter::Off) - .parse_env("ATUIN_LOG") - .init(); - - let mut settings = Settings::new().wrap_err("could not load client settings")?; - - let db_path = PathBuf::from(settings.db_path.as_str()); - let mut db = Sqlite::new(db_path).await?; - - match self { - Self::History(history) => history.run(&settings, &mut db).await, - Self::Import(import) => import.run(&mut db).await, - Self::Stats(stats) => stats.run(&mut db, &settings).await, - Self::Search(search) => search.run(db, &mut settings).await, - #[cfg(feature = "sync")] - Self::Sync(sync) => sync.run(settings, &mut db).await, - } - } -} |
