Skip to main content

mecha10_cli/types/
cli.rs

1//! CLI type definitions
2//!
3//! Root CLI structure and Commands enum.
4//! Individual command Args are defined in the commands/ module.
5
6use clap::{Parser, Subcommand};
7use std::path::PathBuf;
8
9use crate::commands::{
10    AddCommand, AuthCommand, BuildCommand, CacheCommand, ConfigCommand, ConfigValidateArgs, DevArgs, DiagnosticsArgs,
11    FormatArgs, InitArgs, LintArgs, LogsCommand, ModelCommand, PsCommand, RobotCommand, RunCommand, SetupArgs,
12    SimCommand, StopCommand, TargetCommand, TopicsCommand, TopologyArgs, TrainArgs, UploadArgs,
13};
14
15#[derive(Parser)]
16#[command(name = "mecha10")]
17#[command(about = "Mecha10 CLI - Build autonomous robots with RL", long_about = None)]
18#[command(version)]
19pub struct Cli {
20    #[arg(short, long, default_value = "info", global = true)]
21    pub log_level: String,
22
23    #[arg(short, long, global = true)]
24    pub config: Option<PathBuf>,
25
26    #[command(subcommand)]
27    pub command: Commands,
28}
29
30#[derive(Subcommand)]
31pub enum Commands {
32    Add {
33        #[command(subcommand)]
34        command: AddCommand,
35    },
36
37    Auth {
38        #[command(subcommand)]
39        command: AuthCommand,
40    },
41
42    Build {
43        #[command(subcommand)]
44        command: BuildCommand,
45    },
46
47    Cache {
48        #[command(subcommand)]
49        command: CacheCommand,
50    },
51
52    Config {
53        #[command(subcommand)]
54        command: ConfigCommand,
55    },
56
57    Dev(#[command(flatten)] DevArgs),
58
59    Diagnostics(#[command(flatten)] DiagnosticsArgs),
60
61    Format(#[command(flatten)] FormatArgs),
62
63    Init(#[command(flatten)] InitArgs),
64
65    Lint(#[command(flatten)] LintArgs),
66
67    Logs {
68        #[command(subcommand)]
69        command: LogsCommand,
70    },
71
72    Model {
73        #[command(subcommand)]
74        command: ModelCommand,
75    },
76
77    Ps {
78        #[command(subcommand)]
79        command: PsCommand,
80    },
81
82    Robot {
83        #[command(subcommand)]
84        command: RobotCommand,
85    },
86
87    Run {
88        #[command(subcommand)]
89        command: RunCommand,
90    },
91
92    Setup(#[command(flatten)] SetupArgs),
93
94    Sim {
95        #[command(subcommand)]
96        command: SimCommand,
97    },
98
99    Stop {
100        #[command(subcommand)]
101        command: StopCommand,
102    },
103
104    Target {
105        #[command(subcommand)]
106        command: Option<TargetCommand>,
107    },
108
109    Topics {
110        #[command(subcommand)]
111        command: TopicsCommand,
112    },
113
114    Topology(#[command(flatten)] TopologyArgs),
115
116    Train(#[command(flatten)] TrainArgs),
117
118    Upload(#[command(flatten)] UploadArgs),
119
120    Validate(#[command(flatten)] ConfigValidateArgs),
121}