Skip to main content

omni_dev/cli/
config.rs

1//! Configuration-related CLI commands.
2
3use anyhow::Result;
4use clap::{Parser, Subcommand};
5
6use crate::claude::model_config::MODELS_YAML;
7
8/// Configuration operations.
9#[derive(Parser)]
10pub struct ConfigCommand {
11    /// Configuration subcommand to execute.
12    #[command(subcommand)]
13    pub command: ConfigSubcommands,
14}
15
16/// Configuration subcommands.
17#[derive(Subcommand)]
18pub enum ConfigSubcommands {
19    /// AI model configuration and information.
20    Models(ModelsCommand),
21}
22
23/// Models operations.
24#[derive(Parser)]
25pub struct ModelsCommand {
26    /// Models subcommand to execute.
27    #[command(subcommand)]
28    pub command: ModelsSubcommands,
29}
30
31/// Models subcommands.
32#[derive(Subcommand)]
33pub enum ModelsSubcommands {
34    /// Shows the embedded models.yaml configuration.
35    Show(ShowCommand),
36}
37
38/// Show command options.
39#[derive(Parser)]
40pub struct ShowCommand {}
41
42impl ConfigCommand {
43    /// Executes the config command.
44    pub fn execute(self) -> Result<()> {
45        match self.command {
46            ConfigSubcommands::Models(models_cmd) => models_cmd.execute(),
47        }
48    }
49}
50
51impl ModelsCommand {
52    /// Executes the models command.
53    pub fn execute(self) -> Result<()> {
54        match self.command {
55            ModelsSubcommands::Show(show_cmd) => show_cmd.execute(),
56        }
57    }
58}
59
60impl ShowCommand {
61    /// Executes the show command.
62    pub fn execute(self) -> Result<()> {
63        println!("{MODELS_YAML}");
64        Ok(())
65    }
66}