Skip to main content

omni_dev/
cli.rs

1//! CLI interface for omni-dev.
2
3use anyhow::Result;
4use clap::{Parser, Subcommand};
5
6pub mod ai;
7pub mod commands;
8pub mod config;
9pub mod git;
10pub mod help;
11
12/// omni-dev: A comprehensive development toolkit.
13#[derive(Parser)]
14#[command(name = "omni-dev")]
15#[command(about = "A comprehensive development toolkit", long_about = None)]
16#[command(version)]
17pub struct Cli {
18    /// The main command to execute.
19    #[command(subcommand)]
20    pub command: Commands,
21}
22
23/// Main command categories.
24#[derive(Subcommand)]
25pub enum Commands {
26    /// AI operations.
27    Ai(ai::AiCommand),
28    /// Git-related operations.
29    Git(git::GitCommand),
30    /// Command template management.
31    Commands(commands::CommandsCommand),
32    /// Configuration and model information.
33    Config(config::ConfigCommand),
34    /// Displays comprehensive help for all commands.
35    #[command(name = "help-all")]
36    HelpAll(help::HelpCommand),
37}
38
39impl Cli {
40    /// Executes the CLI command.
41    pub async fn execute(self) -> Result<()> {
42        match self.command {
43            Commands::Ai(ai_cmd) => ai_cmd.execute().await,
44            Commands::Git(git_cmd) => git_cmd.execute().await,
45            Commands::Commands(commands_cmd) => commands_cmd.execute(),
46            Commands::Config(config_cmd) => config_cmd.execute(),
47            Commands::HelpAll(help_cmd) => help_cmd.execute(),
48        }
49    }
50}