Skip to main content

auths_cli/commands/debug/
mod.rs

1use anyhow::Result;
2use clap::{Args, Subcommand};
3
4use crate::commands::cache::CacheCommand;
5use crate::commands::executable::ExecutableCommand;
6use crate::commands::index::IndexCommand;
7use crate::commands::utils::UtilCommand;
8use crate::config::CliConfig;
9
10#[derive(Args, Debug, Clone)]
11#[command(about = "Internal debugging utilities")]
12pub struct DebugCmd {
13    #[command(subcommand)]
14    pub command: DebugSubcommand,
15}
16
17#[derive(Subcommand, Debug, Clone)]
18pub enum DebugSubcommand {
19    Cache(CacheCommand),
20    Index(IndexCommand),
21    Util(UtilCommand),
22}
23
24impl ExecutableCommand for DebugCmd {
25    fn execute(&self, ctx: &CliConfig) -> Result<()> {
26        match &self.command {
27            DebugSubcommand::Cache(cmd) => cmd.execute(ctx),
28            DebugSubcommand::Index(cmd) => cmd.execute(ctx),
29            DebugSubcommand::Util(cmd) => cmd.execute(ctx),
30        }
31    }
32}