mecha10-cli 0.6.3

Mecha10 CLI tool
Documentation
//! Add command arguments
//!
//! Commands for adding components to a Mecha10 project.

use clap::{Args, Subcommand, ValueEnum};

/// Add components to the project
#[derive(Subcommand, Debug)]
pub enum AddCommand {
    /// Generate a new custom node (Rust crate in nodes/)
    Node(AddNodeArgs),
    /// Generate a new custom hardware driver (Rust crate in drivers/)
    Driver(AddDriverArgs),
    /// Generate a new custom behavior tree (declarative config.json in behaviors/)
    Behavior(AddBehaviorArgs),
    /// Add a framework node to the project config (e.g., `mecha10 add camera`)
    #[command(external_subcommand)]
    Framework(Vec<String>),
}

/// Arguments for the add node command
#[derive(Args, Debug)]
pub struct AddNodeArgs {
    /// Name of the node to create (e.g., "my-sensor", "path-planner")
    pub name: String,

    /// Description of the node
    #[arg(short, long)]
    pub description: Option<String>,
}

/// Arguments for the add driver command
#[derive(Args, Debug)]
pub struct AddDriverArgs {
    /// Name of the driver to create (e.g., "front-camera", "wheel-motor")
    pub name: String,

    /// Kind of driver boilerplate to generate
    #[arg(short = 't', long, value_enum)]
    pub r#type: AddDriverType,
}

/// Arguments for the add behavior command
#[derive(Args, Debug)]
pub struct AddBehaviorArgs {
    /// Name of the behavior to create (e.g., "patrol-perimeter", "guard-idle")
    pub name: String,

    /// Description of the behavior
    #[arg(short, long)]
    pub description: Option<String>,
}

/// Kind of driver boilerplate `mecha10 add driver --type` generates
#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum AddDriverType {
    /// Camera driver (RGB image + camera info topics)
    Camera,
    /// Motor controller driver (velocity command + odometry topics)
    Motor,
    /// Generic single-value sensor driver
    Sensor,
    /// IMU driver (orientation + angular velocity + linear acceleration topics)
    Imu,
}