Skip to main content

omni_dev/cli/
config.rs

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