objectiveai-cli 2.0.5

ObjectiveAI command-line interface and embeddable library
pub mod config;
pub mod logs;
pub mod remote;
pub mod recursive;
pub mod state;

use clap::Subcommand;

#[derive(Subcommand)]
pub enum Commands {
    /// Recursive function invention
    Recursive {
        #[command(subcommand)]
        command: recursive::Commands,
    },
    /// Inventions configuration
    Config {
        #[command(subcommand)]
        command: config::Commands,
    },
    /// Read invention logs
    Logs {
        #[command(subcommand)]
        command: logs::Commands,
    },
    /// Inventions remote
    Remote {
        #[command(subcommand)]
        command: remote::Commands,
    },
    /// Invention state
    State {
        #[command(subcommand)]
        command: state::Commands,
    },
}

impl Commands {
    pub async fn handle(self, cli_config: &crate::Config, handle: &objectiveai_cli_sdk::output::Handle) -> Result<(), crate::error::Error> {
        match self {
            Commands::Recursive { command } => command.handle(cli_config, handle).await,
            Commands::Config { command } => command.handle(cli_config, handle).await,
            Commands::Logs { command } => command.handle(cli_config, handle).await,
            Commands::Remote { command } => command.handle(cli_config, handle).await,
            Commands::State { command } => command.handle(cli_config, handle).await,
        }
    }
}