1use clap::{Parser, Subcommand};
7use std::path::PathBuf;
8
9use crate::commands::{
10 AddCommand, AuthCommand, BuildCommand, BuildWorkerArgs, CacheCommand, ConfigCommand, ConfigValidateArgs, DevArgs,
11 DiagnosticsArgs, FormatArgs, InitArgs, LintArgs, LogsCommand, ModelCommand, PsCommand, RobotCommand, RunCommand,
12 SetupArgs, 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 #[command(hide = true)]
52 BuildWorker(#[command(flatten)] BuildWorkerArgs),
53
54 Cache {
55 #[command(subcommand)]
56 command: CacheCommand,
57 },
58
59 Config {
60 #[command(subcommand)]
61 command: ConfigCommand,
62 },
63
64 Dev(#[command(flatten)] DevArgs),
65
66 Diagnostics(#[command(flatten)] DiagnosticsArgs),
67
68 Format(#[command(flatten)] FormatArgs),
69
70 Init(#[command(flatten)] InitArgs),
71
72 Lint(#[command(flatten)] LintArgs),
73
74 Logs {
75 #[command(subcommand)]
76 command: LogsCommand,
77 },
78
79 Model {
80 #[command(subcommand)]
81 command: ModelCommand,
82 },
83
84 Ps {
85 #[command(subcommand)]
86 command: PsCommand,
87 },
88
89 Robot {
90 #[command(subcommand)]
91 command: RobotCommand,
92 },
93
94 Run {
95 #[command(subcommand)]
96 command: RunCommand,
97 },
98
99 Setup(#[command(flatten)] SetupArgs),
100
101 Sim {
102 #[command(subcommand)]
103 command: SimCommand,
104 },
105
106 Stop {
107 #[command(subcommand)]
108 command: StopCommand,
109 },
110
111 Target {
112 #[command(subcommand)]
113 command: Option<TargetCommand>,
114 },
115
116 Topics {
117 #[command(subcommand)]
118 command: TopicsCommand,
119 },
120
121 Topology(#[command(flatten)] TopologyArgs),
122
123 Train(#[command(flatten)] TrainArgs),
124
125 Upload(#[command(flatten)] UploadArgs),
126
127 Validate(#[command(flatten)] ConfigValidateArgs),
128}