1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! 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,
}