mecha10-cli 4.2.15

Mecha10 CLI tool
Documentation
//! CLI type definitions
//!
//! Root CLI structure and Commands enum.
//! Individual command Args are defined in the commands/ module.

use clap::{Parser, Subcommand};
use std::path::PathBuf;

use crate::commands::{
    AddCommand, AuthCommand, BuildCommand, BuildWorkerArgs, CacheCommand, ConfigCommand, ConfigValidateArgs, DevArgs,
    DiagnosticsArgs, FormatArgs, InitArgs, LintArgs, LogsCommand, ModelCommand, PsCommand, RobotCommand, RunCommand,
    SetupArgs, SimCommand, StopCommand, TargetCommand, TopicsCommand, TopologyArgs, TrainArgs, UploadArgs,
};

#[derive(Parser)]
#[command(name = "mecha10")]
#[command(about = "Mecha10 CLI - Build autonomous robots with RL", long_about = None)]
#[command(version)]
pub struct Cli {
    #[arg(short, long, default_value = "info", global = true)]
    pub log_level: String,

    #[arg(short, long, global = true)]
    pub config: Option<PathBuf>,

    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Subcommand)]
pub enum Commands {
    Add {
        #[command(subcommand)]
        command: AddCommand,
    },

    Auth {
        #[command(subcommand)]
        command: AuthCommand,
    },

    Build {
        #[command(subcommand)]
        command: BuildCommand,
    },

    /// Internal: run as the dispatched build-worker inside a Kestra build container
    /// (LAB-5440/5442/5443/5450's "build via mecha10 dashboard"). Not meant to be invoked by
    /// end users - see `handlers::build_worker` for the full env var/arg contract a
    /// mecha10-api dispatch must match.
    #[command(hide = true)]
    BuildWorker(#[command(flatten)] BuildWorkerArgs),

    Cache {
        #[command(subcommand)]
        command: CacheCommand,
    },

    Config {
        #[command(subcommand)]
        command: ConfigCommand,
    },

    Dev(#[command(flatten)] DevArgs),

    Diagnostics(#[command(flatten)] DiagnosticsArgs),

    Format(#[command(flatten)] FormatArgs),

    Init(#[command(flatten)] InitArgs),

    Lint(#[command(flatten)] LintArgs),

    Logs {
        #[command(subcommand)]
        command: LogsCommand,
    },

    Model {
        #[command(subcommand)]
        command: ModelCommand,
    },

    Ps {
        #[command(subcommand)]
        command: PsCommand,
    },

    Robot {
        #[command(subcommand)]
        command: RobotCommand,
    },

    Run {
        #[command(subcommand)]
        command: RunCommand,
    },

    Setup(#[command(flatten)] SetupArgs),

    Sim {
        #[command(subcommand)]
        command: SimCommand,
    },

    Stop {
        #[command(subcommand)]
        command: StopCommand,
    },

    Target {
        #[command(subcommand)]
        command: Option<TargetCommand>,
    },

    Topics {
        #[command(subcommand)]
        command: TopicsCommand,
    },

    Topology(#[command(flatten)] TopologyArgs),

    Train(#[command(flatten)] TrainArgs),

    Upload(#[command(flatten)] UploadArgs),

    Validate(#[command(flatten)] ConfigValidateArgs),
}