diff options
Diffstat (limited to '')
| -rw-r--r-- | crates/turtle/src/command/client.rs | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/crates/turtle/src/command/client.rs b/crates/turtle/src/command/client.rs index 9ab28e15..0c97f945 100644 --- a/crates/turtle/src/command/client.rs +++ b/crates/turtle/src/command/client.rs @@ -5,7 +5,7 @@ use clap::Subcommand; use eyre::{Result, WrapErr}; use crate::atuin_client::{ - database::ClientSqlite, record::sqlite_store::SqliteStore, settings::Settings, theme, + database::ClientSqlite, record::sqlite_store::SqliteStore, settings::Settings, }; use tracing_appender::rolling::{RollingFileAppender, Rotation}; use tracing_subscriber::{ @@ -40,13 +40,8 @@ fn cleanup_old_logs(log_dir: &Path, prefix: &str, retention_days: u64) { } } -#[cfg(feature = "sync")] -mod sync; - -#[cfg(feature = "daemon")] -mod daemon; - mod config; +mod daemon; mod default_config; mod history; mod info; @@ -55,6 +50,7 @@ mod search; mod server; mod stats; mod store; +mod sync; mod wrapped; #[derive(Subcommand, Debug)] @@ -67,7 +63,6 @@ pub(crate) enum Cmd { /// Interactive history search Search(search::Cmd), - #[cfg(feature = "sync")] #[command(subcommand)] /// Request a sync or view sync status Sync(sync::Cmd), @@ -96,7 +91,6 @@ pub(crate) enum Cmd { Wrapped { year: Option<i32> }, /// *Experimental* Manage the background daemon - #[cfg(feature = "daemon")] #[command()] Daemon(daemon::Cmd), @@ -134,9 +128,8 @@ impl Cmd { // doing anything else. History commands are performance-sensitive and run before and after // every shell command, so we want to skip any unnecessary initialization for them. let settings = Settings::new().wrap_err("could not load client settings")?; - let theme_manager = theme::ThemeManager::new(settings.theme.debug, None); - runtime.block_on(self.run_inner(settings, theme_manager)) + runtime.block_on(self.run_inner(settings)) }; runtime.shutdown_timeout(std::time::Duration::from_millis(50)); @@ -145,11 +138,7 @@ impl Cmd { } #[expect(clippy::too_many_lines)] - async fn run_inner( - self, - mut settings: Settings, - mut theme_manager: theme::ThemeManager, - ) -> Result<()> { + async fn run_inner(self, mut settings: Settings) -> Result<()> { // ATUIN_LOG env var overrides config file level settings let env_log_set = std::env::var("ATUIN_LOG").is_ok(); @@ -162,19 +151,11 @@ impl Cmd { let use_search_logging = is_interactive_search && settings.logs.search_enabled(); // Use file-based logging for daemon - #[cfg(feature = "daemon")] let use_daemon_logging = matches!(&self, Self::Daemon(_)) && settings.logs.daemon_enabled(); - #[cfg(not(feature = "daemon"))] - let use_daemon_logging = false; - // Check if daemon should also log to console - #[cfg(feature = "daemon")] let daemon_show_logs = matches!(&self, Self::Daemon(cmd) if cmd.show_logs()); - #[cfg(not(feature = "daemon"))] - let daemon_show_logs = false; - // Set up span timing JSON logs if ATUIN_SPAN is set let span_path = std::env::var("ATUIN_SPAN").ok().map(|p| { if p.is_empty() { @@ -317,14 +298,11 @@ impl Cmd { let db = ClientSqlite::new(db_path, settings.local_timeout).await?; let sqlite_store = SqliteStore::new(record_store_path, settings.local_timeout).await?; - let theme_name = settings.theme.name.clone(); - let theme = theme_manager.load_theme(theme_name.as_str(), settings.theme.max_depth); - match self { - Self::Stats(stats) => stats.run(&db, &settings, theme).await, - Self::Search(search) => search.run(db, &mut settings, sqlite_store, theme).await, + Self::Stats(stats) => stats.run(&db, &settings).await, + Self::Search(search) => search.run(db, &mut settings, sqlite_store).await, + Self::Wrapped { year } => wrapped::run(year, &db, &settings).await, - #[cfg(feature = "sync")] Self::Sync(sync) => sync.run(settings, &db, sqlite_store).await, Self::Store(store) => store.run(&settings, &db, sqlite_store).await, @@ -336,9 +314,6 @@ impl Cmd { Ok(()) } - Self::Wrapped { year } => wrapped::run(year, &db, &settings, theme).await, - - #[cfg(feature = "daemon")] Self::Daemon(cmd) => cmd.run(settings, sqlite_store, db).await, Self::History(_) | Self::Init(_) | Self::Config(_) | Self::Server(_) => { |
