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