aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/client.rs
diff options
context:
space:
mode:
authorc-14 <git@c-14.de>2022-09-25 12:15:33 +0200
committerGitHub <noreply@github.com>2022-09-25 11:15:33 +0100
commit045c87fbcd1cb8efe8bd3a41f55790b326ed6ee4 (patch)
tree6c50c7b388aafb719dca1acb90dd363790288a31 /src/command/client.rs
parentRelease v11 (#529) (diff)
downloadatuin-045c87fbcd1cb8efe8bd3a41f55790b326ed6ee4.zip
Allow stateless commands to be run without config/database (#544)
* Allow stateless commands to be run without config/database Fixes an issue where gen-completions fails trying to create a config directory in restrained build environments/distribution. * move non-db commands up to core subcommands * re-add lost lines * re-add lost lines Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
Diffstat (limited to '')
-rw-r--r--src/command/client.rs50
1 files changed, 1 insertions, 49 deletions
diff --git a/src/command/client.rs b/src/command/client.rs
index ae49b857..94148c09 100644
--- a/src/command/client.rs
+++ b/src/command/client.rs
@@ -1,18 +1,15 @@
use std::path::PathBuf;
-use clap::{CommandFactory, Subcommand};
-use clap_complete::{generate, generate_to, Shell};
+use clap::Subcommand;
use eyre::{Result, WrapErr};
use atuin_client::{database::Sqlite, settings::Settings};
-use atuin_common::utils::uuid_v4;
#[cfg(feature = "sync")]
mod sync;
mod history;
mod import;
-mod init;
mod search;
mod stats;
@@ -30,27 +27,9 @@ pub enum Cmd {
/// Calculate statistics for your history
Stats(stats::Cmd),
- /// Output shell setup
- #[clap(subcommand)]
- Init(init::Cmd),
-
- /// Generate a UUID
- Uuid,
-
/// Interactive history search
Search(search::Cmd),
- /// Generate shell completions
- GenCompletions {
- /// Set the shell for generating completions
- #[clap(long, short)]
- shell: Shell,
-
- /// Set the output directory
- #[clap(long, short)]
- out_dir: Option<String>,
- },
-
#[cfg(feature = "sync")]
#[clap(flatten)]
Sync(sync::Cmd),
@@ -70,34 +49,7 @@ impl Cmd {
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::Init(init) => {
- init.run();
- Ok(())
- }
Self::Search(search) => search.run(&mut db, &settings).await,
- Self::Uuid => {
- println!("{}", uuid_v4());
- Ok(())
- }
- Self::GenCompletions { shell, out_dir } => {
- let mut cli = crate::Atuin::command();
-
- match out_dir {
- Some(out_dir) => {
- generate_to(shell, &mut cli, env!("CARGO_PKG_NAME"), &out_dir)?;
- }
- None => {
- generate(
- shell,
- &mut cli,
- env!("CARGO_PKG_NAME"),
- &mut std::io::stdout(),
- );
- }
- }
-
- Ok(())
- }
#[cfg(feature = "sync")]
Self::Sync(sync) => sync.run(settings, &mut db).await,
}