atuin 18.20.0

atuin - magical shell history
//! Internal subcommands, not for direct use by users.

use atuin_client::settings::Settings;
use atuin_common::logs::LogConfig;
use tracing::instrument;

#[derive(clap::Subcommand, Debug)]
pub enum Cmd {
    PrepareSearchIndex,
}

impl Cmd {
    #[instrument(level = "trace", skip_all, err)]
    pub async fn run(self, settings: &Settings) -> eyre::Result<()> {
        match self {
            Self::PrepareSearchIndex => super::search::prepare_index(settings).await,
        }
    }

    pub fn log_config(&self) -> Option<LogConfig> {
        match self {
            // This command is called from the shell hooks with no stdout/stderr; there's no point
            // in initializing logging.
            Self::PrepareSearchIndex => None,
        }
    }
}