auths-cli 0.0.1-rc.8

Command-line interface for Auths decentralized identity system
Documentation
use anyhow::Result;
use clap::{Args, Subcommand};

use crate::commands::cache::CacheCommand;
use crate::commands::executable::ExecutableCommand;
use crate::commands::index::IndexCommand;
use crate::commands::utils::UtilCommand;
use crate::config::CliConfig;

#[derive(Args, Debug, Clone)]
#[command(about = "Internal debugging utilities")]
pub struct DebugCmd {
    #[command(subcommand)]
    pub command: DebugSubcommand,
}

#[derive(Subcommand, Debug, Clone)]
pub enum DebugSubcommand {
    Cache(CacheCommand),
    Index(IndexCommand),
    Util(UtilCommand),
}

impl ExecutableCommand for DebugCmd {
    fn execute(&self, ctx: &CliConfig) -> Result<()> {
        match &self.command {
            DebugSubcommand::Cache(cmd) => cmd.execute(ctx),
            DebugSubcommand::Index(cmd) => cmd.execute(ctx),
            DebugSubcommand::Util(cmd) => cmd.execute(ctx),
        }
    }
}