1pub mod clean;
2pub mod look;
3pub mod off;
4pub mod on;
5pub mod prep;
6pub mod report;
7pub mod ticket;
8
9use clap::{Args, Parser, Subcommand};
10
11#[derive(Parser)]
12#[command(name = "oven", about = "let 'em cook", version)]
13pub struct Cli {
14 #[command(flatten)]
15 pub global: GlobalOpts,
16 #[command(subcommand)]
17 pub command: Commands,
18}
19
20#[derive(Args)]
21pub struct GlobalOpts {
22 #[arg(global = true, short, long)]
24 pub verbose: bool,
25 #[arg(global = true, short, long)]
27 pub quiet: bool,
28}
29
30#[derive(Subcommand)]
31pub enum Commands {
32 Prep(PrepArgs),
34 On(OnArgs),
36 Off,
38 Look(LookArgs),
40 Report(ReportArgs),
42 Clean(CleanArgs),
44 Ticket(TicketArgs),
46}
47
48#[derive(Args)]
49pub struct PrepArgs {
50 #[arg(long)]
52 pub force: bool,
53}
54
55#[derive(Args)]
56pub struct OnArgs {
57 pub ids: Option<String>,
59 #[arg(short, long)]
61 pub detached: bool,
62 #[arg(short, long)]
64 pub merge: bool,
65 #[arg(long)]
67 pub trust: bool,
68 #[arg(long, hide = true)]
70 pub run_id: Option<String>,
71}
72
73#[derive(Args)]
74pub struct LookArgs {
75 pub run_id: Option<String>,
77 #[arg(long)]
79 pub agent: Option<String>,
80 #[arg(long)]
82 pub stream: bool,
83}
84
85#[derive(Args)]
86pub struct ReportArgs {
87 pub run_id: Option<String>,
89 #[arg(long)]
91 pub all: bool,
92 #[arg(long)]
94 pub json: bool,
95 #[arg(long)]
97 pub graph: bool,
98}
99
100#[derive(Args)]
101pub struct CleanArgs {
102 #[arg(long)]
104 pub only_logs: bool,
105 #[arg(long)]
107 pub only_trees: bool,
108 #[arg(long)]
110 pub only_branches: bool,
111}
112
113#[derive(Args)]
114pub struct TicketArgs {
115 #[command(subcommand)]
116 pub command: TicketCommands,
117}
118
119#[derive(Subcommand)]
120pub enum TicketCommands {
121 Create(TicketCreateArgs),
123 List(TicketListArgs),
125 View(TicketViewArgs),
127 Close(TicketCloseArgs),
129 Label(TicketLabelArgs),
131 Edit(TicketEditArgs),
133}
134
135#[derive(Args)]
136pub struct TicketCreateArgs {
137 pub title: String,
139 #[arg(long)]
141 pub body: Option<String>,
142 #[arg(long)]
144 pub ready: bool,
145 #[arg(long)]
147 pub repo: Option<String>,
148}
149
150#[derive(Args)]
151pub struct TicketListArgs {
152 #[arg(long)]
154 pub label: Option<String>,
155 #[arg(long)]
157 pub status: Option<String>,
158}
159
160#[derive(Args)]
161pub struct TicketViewArgs {
162 pub id: u32,
164}
165
166#[derive(Args)]
167pub struct TicketCloseArgs {
168 pub id: u32,
170}
171
172#[derive(Args)]
173pub struct TicketLabelArgs {
174 pub id: u32,
176 pub label: String,
178 #[arg(long)]
180 pub remove: bool,
181}
182
183#[derive(Args)]
184pub struct TicketEditArgs {
185 pub id: u32,
187}
188
189#[cfg(test)]
190mod tests {
191 use super::*;
192
193 #[test]
194 fn verify_cli() {
195 use clap::CommandFactory;
196 Cli::command().debug_assert();
197 }
198}