1use std::{ffi::OsString, path::PathBuf};
2
3use crate::dw_cmd::DwCommand;
4use crate::secrets_cli::SecretsCommand;
5use clap::{Arg, ArgAction, Args, CommandFactory, Parser, Subcommand};
6
7#[derive(Parser, Debug)]
8#[command(name = "greentic-dev")]
9#[command(version)]
10#[command(about = "cli.root.about")]
11pub struct Cli {
12 #[command(subcommand)]
13 pub command: Command,
14}
15
16pub fn localized_help_command(locale: &str) -> clap::Command {
17 let mut command = Cli::command()
18 .about(crate::i18n::t(locale, "cli.root.about"))
19 .disable_help_subcommand(true)
20 .disable_help_flag(true)
21 .disable_version_flag(true)
22 .arg(
23 Arg::new("help")
24 .short('h')
25 .long("help")
26 .action(ArgAction::Help)
27 .help(crate::i18n::t(locale, "cli.help.flag")),
28 )
29 .arg(
30 Arg::new("version")
31 .short('V')
32 .long("version")
33 .action(ArgAction::Version)
34 .help(crate::i18n::t(locale, "cli.version.flag")),
35 )
36 .arg(
37 Arg::new("locale")
38 .long("locale")
39 .global(true)
40 .value_name("LOCALE")
41 .help(crate::i18n::t(locale, "cli.option.locale")),
42 );
43
44 for (name, key) in [
45 ("flow", "cli.command.flow.about"),
46 ("pack", "cli.command.pack.about"),
47 ("component", "cli.command.component.about"),
48 ("bundle", "cli.command.bundle.about"),
49 ("runner", "cli.command.runner.about"),
50 ("config", "cli.command.config.about"),
51 ("coverage", "cli.command.coverage.about"),
52 ("security", "cli.command.security.about"),
53 ("mcp", "cli.command.mcp.about"),
54 ("gui", "cli.command.gui.about"),
55 ("secrets", "cli.command.secrets.about"),
56 ("dw", "cli.command.dw.about"),
57 ("tools", "cli.command.tools.about"),
58 ("install", "cli.command.install.about"),
59 ("release", "cli.command.release.about"),
60 ("cbor", "cli.command.cbor.about"),
61 ("wizard", "cli.command.wizard.about"),
62 ] {
63 command = command.mut_subcommand(name, |sub| sub.about(crate::i18n::t(locale, key)));
64 }
65
66 command = command.mut_subcommand("secrets", |sub| {
67 sub.about(crate::i18n::t(locale, "cli.command.secrets.about"))
68 .mut_subcommand("init", |sub| {
69 sub.about(crate::i18n::t(locale, "cli.command.secrets.init.about"))
70 .mut_arg("pack", |arg| {
71 arg.help(crate::i18n::t(locale, "cli.command.secrets.init.pack"))
72 })
73 .mut_arg("passthrough", |arg| {
74 arg.help(crate::i18n::t(
75 locale,
76 "cli.command.secrets.init.passthrough",
77 ))
78 })
79 })
80 });
81
82 command = command.mut_subcommand("dw", |sub| {
83 sub.about(crate::i18n::t(locale, "cli.command.dw.about"))
84 .mut_subcommand("publish", |sub| {
85 sub.about(crate::i18n::t(locale, "cli.command.dw.publish.about"))
86 .mut_arg("artifact", |arg| {
87 arg.help(crate::i18n::t(locale, "cli.command.dw.publish.artifact"))
88 })
89 .mut_arg("describe", |arg| {
90 arg.help(crate::i18n::t(locale, "cli.command.dw.publish.describe"))
91 })
92 .mut_arg("store", |arg| {
93 arg.help(crate::i18n::t(locale, "cli.command.dw.publish.store"))
94 })
95 .mut_arg("token", |arg| {
96 arg.help(crate::i18n::t(locale, "cli.command.dw.publish.token"))
97 })
98 })
99 .mut_subcommand("install", |sub| {
100 sub.about(crate::i18n::t(locale, "cli.command.dw.install.about"))
101 .mut_arg("name", |arg| {
102 arg.help(crate::i18n::t(locale, "cli.command.dw.install.name"))
103 })
104 .mut_arg("version", |arg| {
105 arg.help(crate::i18n::t(locale, "cli.command.dw.install.version"))
106 })
107 .mut_arg("store", |arg| {
108 arg.help(crate::i18n::t(locale, "cli.command.dw.install.store"))
109 })
110 .mut_arg("out", |arg| {
111 arg.help(crate::i18n::t(locale, "cli.command.dw.install.out"))
112 })
113 })
114 });
115 command = command
116 .mut_subcommand("config", |sub| {
117 sub.about(crate::i18n::t(locale, "cli.command.config.about"))
118 .mut_subcommand("set", |sub| {
119 sub.about(crate::i18n::t(locale, "cli.command.config.set.about"))
120 .mut_arg("key", |arg| {
121 arg.help(crate::i18n::t(locale, "cli.command.config.set.key"))
122 })
123 .mut_arg("value", |arg| {
124 arg.help(crate::i18n::t(locale, "cli.command.config.set.value"))
125 })
126 .mut_arg("file", |arg| {
127 arg.help(crate::i18n::t(locale, "cli.command.config.set.file"))
128 })
129 })
130 })
131 .mut_subcommand("mcp", |sub| {
132 sub.about(crate::i18n::t(locale, "cli.command.mcp.about"))
133 .mut_subcommand("doctor", |sub| {
134 sub.about(crate::i18n::t(locale, "cli.command.mcp.doctor.about"))
135 .mut_arg("provider", |arg| {
136 arg.help(crate::i18n::t(locale, "cli.command.mcp.doctor.provider"))
137 })
138 .mut_arg("json", |arg| {
139 arg.help(crate::i18n::t(locale, "cli.command.mcp.doctor.json"))
140 })
141 })
142 .mut_subcommand("gen", |sub| {
143 sub.about(crate::i18n::t(locale, "cli.command.mcp.gen.about"))
144 })
145 })
146 .mut_subcommand("tools", |sub| {
147 sub.about(crate::i18n::t(locale, "cli.command.tools.about"))
148 .mut_subcommand("install", |sub| {
149 sub.about(crate::i18n::t(locale, "cli.command.tools.install.about"))
150 .mut_arg("latest", |arg| {
151 arg.help(crate::i18n::t(locale, "cli.command.tools.install.latest"))
152 })
153 })
154 })
155 .mut_subcommand("install", |sub| {
156 sub.about(crate::i18n::t(locale, "cli.command.install.about"))
157 .mut_subcommand("tools", |sub| {
158 sub.about(crate::i18n::t(locale, "cli.command.install.tools.about"))
159 .mut_arg("latest", |arg| {
160 arg.help(crate::i18n::t(locale, "cli.command.tools.install.latest"))
161 })
162 })
163 .mut_arg("tenant", |arg| {
164 arg.help(crate::i18n::t(locale, "cli.command.install.tenant"))
165 })
166 .mut_arg("token", |arg| {
167 arg.help(crate::i18n::t(locale, "cli.command.install.token"))
168 })
169 .mut_arg("bin_dir", |arg| {
170 arg.help(crate::i18n::t(locale, "cli.command.install.bin_dir"))
171 })
172 .mut_arg("docs_dir", |arg| {
173 arg.help(crate::i18n::t(locale, "cli.command.install.docs_dir"))
174 })
175 .mut_arg("locale", |arg| {
176 arg.help(crate::i18n::t(locale, "cli.command.install.locale"))
177 })
178 })
179 .mut_subcommand("release", |sub| {
180 sub.about(crate::i18n::t(locale, "cli.command.release.about"))
181 .mut_subcommand("generate", |sub| {
182 sub.about(crate::i18n::t(locale, "cli.command.release.generate.about"))
183 .mut_arg("release", |arg| {
184 arg.help(crate::i18n::t(locale, "cli.command.release.release"))
185 })
186 .mut_arg("from", |arg| {
187 arg.help(crate::i18n::t(locale, "cli.command.release.from"))
188 })
189 .mut_arg("repo", |arg| {
190 arg.help(crate::i18n::t(locale, "cli.command.release.repo"))
191 })
192 .mut_arg("token", |arg| {
193 arg.help(crate::i18n::t(locale, "cli.command.release.token"))
194 })
195 .mut_arg("out", |arg| {
196 arg.help(crate::i18n::t(locale, "cli.command.release.out"))
197 })
198 .mut_arg("dry_run", |arg| {
199 arg.help(crate::i18n::t(locale, "cli.command.release.dry_run"))
200 })
201 })
202 .mut_subcommand("publish", |sub| {
203 sub.about(crate::i18n::t(locale, "cli.command.release.publish.about"))
204 .mut_arg("release", |arg| {
205 arg.help(crate::i18n::t(locale, "cli.command.release.release"))
206 })
207 .mut_arg("from", |arg| {
208 arg.help(crate::i18n::t(locale, "cli.command.release.from"))
209 })
210 .mut_arg("tag", |arg| {
211 arg.help(crate::i18n::t(locale, "cli.command.release.tag"))
212 })
213 .mut_arg("manifest", |arg| {
214 arg.help(crate::i18n::t(locale, "cli.command.release.manifest"))
215 })
216 .mut_arg("repo", |arg| {
217 arg.help(crate::i18n::t(locale, "cli.command.release.repo"))
218 })
219 .mut_arg("token", |arg| {
220 arg.help(crate::i18n::t(locale, "cli.command.release.token"))
221 })
222 .mut_arg("out", |arg| {
223 arg.help(crate::i18n::t(locale, "cli.command.release.out"))
224 })
225 .mut_arg("dry_run", |arg| {
226 arg.help(crate::i18n::t(locale, "cli.command.release.dry_run"))
227 })
228 .mut_arg("force", |arg| {
229 arg.help(crate::i18n::t(locale, "cli.command.release.force"))
230 })
231 })
232 .mut_subcommand("view", |sub| {
233 sub.about(crate::i18n::t(locale, "cli.command.release.view.about"))
234 .mut_arg("release", |arg| {
235 arg.help(crate::i18n::t(locale, "cli.command.release.release"))
236 })
237 .mut_arg("tag", |arg| {
238 arg.help(crate::i18n::t(locale, "cli.command.release.tag"))
239 })
240 .mut_arg("repo", |arg| {
241 arg.help(crate::i18n::t(locale, "cli.command.release.repo"))
242 })
243 .mut_arg("token", |arg| {
244 arg.help(crate::i18n::t(locale, "cli.command.release.token"))
245 })
246 })
247 .mut_subcommand("latest", |sub| {
248 sub.about(crate::i18n::t(locale, "cli.command.release.latest.about"))
249 .mut_arg("repo", |arg| {
250 arg.help(crate::i18n::t(locale, "cli.command.release.repo"))
251 })
252 .mut_arg("token", |arg| {
253 arg.help(crate::i18n::t(locale, "cli.command.release.token"))
254 })
255 .mut_arg("dry_run", |arg| {
256 arg.help(crate::i18n::t(locale, "cli.command.release.dry_run"))
257 })
258 .mut_arg("force", |arg| {
259 arg.help(crate::i18n::t(locale, "cli.command.release.force"))
260 })
261 })
262 .mut_subcommand("promote", |sub| {
263 sub.about(crate::i18n::t(locale, "cli.command.release.promote.about"))
264 .mut_arg("release", |arg| {
265 arg.help(crate::i18n::t(locale, "cli.command.release.release"))
266 })
267 .mut_arg("tag", |arg| {
268 arg.help(crate::i18n::t(locale, "cli.command.release.tag"))
269 })
270 .mut_arg("repo", |arg| {
271 arg.help(crate::i18n::t(locale, "cli.command.release.repo"))
272 })
273 .mut_arg("token", |arg| {
274 arg.help(crate::i18n::t(locale, "cli.command.release.token"))
275 })
276 .mut_arg("dry_run", |arg| {
277 arg.help(crate::i18n::t(locale, "cli.command.release.dry_run"))
278 })
279 })
280 })
281 .mut_subcommand("cbor", |sub| {
282 sub.about(crate::i18n::t(locale, "cli.command.cbor.about"))
283 .mut_arg("path", |arg| {
284 arg.help(crate::i18n::t(locale, "cli.command.cbor.path"))
285 })
286 })
287 .mut_subcommand("coverage", |sub| {
288 sub.about(crate::i18n::t(locale, "cli.command.coverage.about"))
289 .mut_arg("skip_run", |arg| {
290 arg.help(crate::i18n::t(locale, "cli.command.coverage.skip_run"))
291 })
292 })
293 .mut_subcommand("security", |sub| {
294 sub.about(crate::i18n::t(locale, "cli.command.security.about"))
295 .mut_arg("format", |arg| {
296 arg.help(crate::i18n::t(locale, "cli.command.security.format"))
297 })
298 .mut_arg("prompt", |arg| {
299 arg.help(crate::i18n::t(locale, "cli.command.security.prompt"))
300 })
301 .mut_arg("no_errors", |arg| {
302 arg.help(crate::i18n::t(locale, "cli.command.security.no_errors"))
303 })
304 .mut_arg("severity", |arg| {
305 arg.help(crate::i18n::t(locale, "cli.command.security.severity"))
306 })
307 .mut_arg("security_severity", |arg| {
308 arg.help(crate::i18n::t(
309 locale,
310 "cli.command.security.security_severity",
311 ))
312 })
313 .mut_arg("state", |arg| {
314 arg.help(crate::i18n::t(locale, "cli.command.security.state"))
315 })
316 .mut_arg("repo", |arg| {
317 arg.help(crate::i18n::t(locale, "cli.command.security.repo"))
318 })
319 .mut_arg("branch", |arg| {
320 arg.help(crate::i18n::t(locale, "cli.command.security.branch"))
321 })
322 })
323 .mut_subcommand("wizard", |sub| {
324 sub.about(crate::i18n::t(locale, "cli.command.wizard.about"))
325 .mut_arg("answers", |arg| {
326 arg.help(crate::i18n::t(locale, "cli.command.wizard.answers"))
327 })
328 .mut_arg("frontend", |arg| {
329 arg.help(crate::i18n::t(locale, "cli.command.wizard.frontend"))
330 })
331 .mut_arg("locale", |arg| {
332 arg.help(crate::i18n::t(locale, "cli.command.wizard.locale"))
333 })
334 .mut_arg("emit_answers", |arg| {
335 arg.help(crate::i18n::t(locale, "cli.command.wizard.emit_answers"))
336 })
337 .mut_arg("schema", |arg| {
338 arg.help(crate::i18n::t(locale, "cli.command.wizard.schema"))
339 .long_help(crate::i18n::t(locale, "cli.command.wizard.schema_long"))
340 })
341 .mut_arg("schema_version", |arg| {
342 arg.help(crate::i18n::t(locale, "cli.command.wizard.schema_version"))
343 })
344 .mut_arg("migrate", |arg| {
345 arg.help(crate::i18n::t(locale, "cli.command.wizard.migrate"))
346 })
347 .mut_arg("out", |arg| {
348 arg.help(crate::i18n::t(locale, "cli.command.wizard.out"))
349 })
350 .mut_arg("dry_run", |arg| {
351 arg.help(crate::i18n::t(locale, "cli.command.wizard.dry_run"))
352 })
353 .mut_arg("yes", |arg| {
354 arg.help(crate::i18n::t(locale, "cli.command.wizard.yes"))
355 })
356 .mut_arg("non_interactive", |arg| {
357 arg.help(crate::i18n::t(locale, "cli.command.wizard.non_interactive"))
358 })
359 .mut_arg("unsafe_commands", |arg| {
360 arg.help(crate::i18n::t(locale, "cli.command.wizard.unsafe_commands"))
361 })
362 .mut_arg("allow_destructive", |arg| {
363 arg.help(crate::i18n::t(
364 locale,
365 "cli.command.wizard.allow_destructive",
366 ))
367 })
368 .mut_subcommand("validate", |sub| {
369 sub.about(crate::i18n::t(locale, "cli.command.wizard.validate.about"))
370 .mut_arg("answers", |arg| {
371 arg.help(crate::i18n::t(locale, "cli.command.wizard.answers"))
372 })
373 .mut_arg("frontend", |arg| {
374 arg.help(crate::i18n::t(locale, "cli.command.wizard.frontend"))
375 })
376 .mut_arg("locale", |arg| {
377 arg.help(crate::i18n::t(locale, "cli.command.wizard.locale"))
378 })
379 .mut_arg("emit_answers", |arg| {
380 arg.help(crate::i18n::t(locale, "cli.command.wizard.emit_answers"))
381 })
382 .mut_arg("schema_version", |arg| {
383 arg.help(crate::i18n::t(locale, "cli.command.wizard.schema_version"))
384 })
385 .mut_arg("migrate", |arg| {
386 arg.help(crate::i18n::t(locale, "cli.command.wizard.migrate"))
387 })
388 .mut_arg("out", |arg| {
389 arg.help(crate::i18n::t(locale, "cli.command.wizard.out"))
390 })
391 })
392 .mut_subcommand("apply", |sub| {
393 sub.about(crate::i18n::t(locale, "cli.command.wizard.apply.about"))
394 .mut_arg("answers", |arg| {
395 arg.help(crate::i18n::t(locale, "cli.command.wizard.answers"))
396 })
397 .mut_arg("frontend", |arg| {
398 arg.help(crate::i18n::t(locale, "cli.command.wizard.frontend"))
399 })
400 .mut_arg("locale", |arg| {
401 arg.help(crate::i18n::t(locale, "cli.command.wizard.locale"))
402 })
403 .mut_arg("emit_answers", |arg| {
404 arg.help(crate::i18n::t(locale, "cli.command.wizard.emit_answers"))
405 })
406 .mut_arg("schema_version", |arg| {
407 arg.help(crate::i18n::t(locale, "cli.command.wizard.schema_version"))
408 })
409 .mut_arg("migrate", |arg| {
410 arg.help(crate::i18n::t(locale, "cli.command.wizard.migrate"))
411 })
412 .mut_arg("out", |arg| {
413 arg.help(crate::i18n::t(locale, "cli.command.wizard.out"))
414 })
415 .mut_arg("yes", |arg| {
416 arg.help(crate::i18n::t(locale, "cli.command.wizard.yes"))
417 })
418 .mut_arg("non_interactive", |arg| {
419 arg.help(crate::i18n::t(locale, "cli.command.wizard.non_interactive"))
420 })
421 .mut_arg("unsafe_commands", |arg| {
422 arg.help(crate::i18n::t(locale, "cli.command.wizard.unsafe_commands"))
423 })
424 .mut_arg("allow_destructive", |arg| {
425 arg.help(crate::i18n::t(
426 locale,
427 "cli.command.wizard.allow_destructive",
428 ))
429 })
430 })
431 });
432
433 localize_help_tree(command, locale, true)
434}
435
436fn localize_help_tree(mut command: clap::Command, locale: &str, is_root: bool) -> clap::Command {
437 command = command
438 .disable_help_subcommand(true)
439 .disable_help_flag(true);
440 let arg_ids = command
441 .get_arguments()
442 .map(|arg| arg.get_id().as_str().to_string())
443 .collect::<Vec<_>>();
444 if arg_ids.iter().any(|id| id == "help") {
445 command = command.mut_arg("help", |arg| {
446 arg.help(crate::i18n::t(locale, "cli.help.flag"))
447 });
448 } else {
449 command = command.arg(
450 Arg::new("help")
451 .short('h')
452 .long("help")
453 .action(ArgAction::Help)
454 .help(crate::i18n::t(locale, "cli.help.flag")),
455 );
456 }
457 if is_root && arg_ids.iter().any(|id| id == "version") {
458 command = command.mut_arg("version", |arg| {
459 arg.help(crate::i18n::t(locale, "cli.version.flag"))
460 });
461 }
462
463 let sub_names = command
464 .get_subcommands()
465 .map(|sub| sub.get_name().to_string())
466 .collect::<Vec<_>>();
467 for name in sub_names {
468 command = command.mut_subcommand(name, |sub| localize_help_tree(sub, locale, false));
469 }
470
471 command
472}
473
474#[derive(Subcommand, Debug)]
475pub enum Command {
476 Flow(PassthroughArgs),
478 Pack(PassthroughArgs),
480 Component(PassthroughArgs),
482 Bundle(PassthroughArgs),
484 Runner(PassthroughArgs),
486 #[command(subcommand)]
488 Config(ConfigCommand),
489 Coverage(CoverageArgs),
491 Security(SecurityArgs),
493 #[command(subcommand)]
495 Mcp(McpCommand),
496 Gui(PassthroughArgs),
498 #[command(subcommand)]
500 Secrets(SecretsCommand),
501 #[command(subcommand)]
503 Dw(DwCommand),
504 #[command(subcommand)]
506 Tools(ToolsCommand),
507 Install(InstallArgs),
509 #[command(subcommand)]
511 Release(ReleaseCommand),
512 Cbor(CborArgs),
514 Wizard(Box<WizardCommand>),
516}
517
518#[derive(Args, Debug, Clone)]
519#[command(disable_help_flag = true)]
520pub struct PassthroughArgs {
521 #[arg(
523 value_name = "ARGS",
524 trailing_var_arg = true,
525 allow_hyphen_values = true
526 )]
527 pub args: Vec<OsString>,
528}
529
530#[derive(Subcommand, Debug)]
531pub enum McpCommand {
532 Doctor(McpDoctorArgs),
534 Gen(PassthroughArgs),
536}
537
538#[derive(Args, Debug)]
539pub struct McpDoctorArgs {
540 pub provider: Option<String>,
542 #[arg(long = "json")]
544 pub json: bool,
545}
546
547#[derive(Subcommand, Debug)]
548pub enum ConfigCommand {
549 Set(ConfigSetArgs),
551}
552
553#[derive(Subcommand, Debug)]
554pub enum ToolsCommand {
555 Install(ToolsInstallArgs),
557}
558
559#[derive(Subcommand, Debug)]
560pub enum InstallSubcommand {
561 Tools(ToolsInstallArgs),
563}
564
565#[derive(Subcommand, Debug)]
566pub enum ReleaseCommand {
567 Generate(ReleaseGenerateArgs),
569 Publish(ReleasePublishArgs),
571 View(ReleaseViewArgs),
573 Latest(ReleaseLatestArgs),
575 Promote(ReleasePromoteArgs),
577 Snapshot(ReleaseSnapshotArgs),
579}
580
581#[derive(Args, Debug)]
582pub struct InstallArgs {
583 #[command(subcommand)]
584 pub command: Option<InstallSubcommand>,
585 #[arg(long = "tenant")]
587 pub tenant: Option<String>,
588 #[arg(long = "token")]
590 pub token: Option<String>,
591 #[arg(long = "bin-dir")]
593 pub bin_dir: Option<PathBuf>,
594 #[arg(long = "docs-dir")]
596 pub docs_dir: Option<PathBuf>,
597 #[arg(long = "locale")]
599 pub locale: Option<String>,
600}
601
602#[derive(Args, Debug)]
603pub struct ToolsInstallArgs {
604 #[arg(long = "latest")]
606 pub latest: bool,
607}
608
609#[derive(Args, Debug)]
610pub struct ReleaseGenerateArgs {
611 #[arg(long = "release")]
613 pub release: String,
614 #[arg(long = "from", default_value = "latest")]
616 pub from: String,
617 #[arg(
619 long = "repo",
620 default_value = "ghcr.io/greenticai/greentic-versions/gtc"
621 )]
622 pub repo: String,
623 #[arg(long = "token")]
625 pub token: Option<String>,
626 #[arg(long = "out", default_value = "dist/toolchains")]
628 pub out: PathBuf,
629 #[arg(long = "dry-run")]
631 pub dry_run: bool,
632}
633
634#[derive(Args, Debug)]
635pub struct ReleasePublishArgs {
636 #[arg(long = "release", required_unless_present = "manifest")]
638 pub release: Option<String>,
639 #[arg(long = "from", default_value = "latest", requires = "release")]
641 pub from: Option<String>,
642 #[arg(long = "tag")]
644 pub tag: Option<String>,
645 #[arg(long = "manifest", required_unless_present = "release")]
647 pub manifest: Option<PathBuf>,
648 #[arg(
650 long = "repo",
651 default_value = "ghcr.io/greenticai/greentic-versions/gtc"
652 )]
653 pub repo: String,
654 #[arg(long = "token")]
656 pub token: Option<String>,
657 #[arg(long = "out", default_value = "dist/toolchains")]
659 pub out: PathBuf,
660 #[arg(long = "dry-run")]
662 pub dry_run: bool,
663 #[arg(long = "force")]
665 pub force: bool,
666 #[arg(long = "no-notify-updater")]
668 pub no_notify_updater: bool,
669}
670
671#[derive(Args, Debug)]
672pub struct ReleaseViewArgs {
673 #[arg(
675 long = "release",
676 conflicts_with = "tag",
677 required_unless_present = "tag"
678 )]
679 pub release: Option<String>,
680 #[arg(
682 long = "tag",
683 conflicts_with = "release",
684 required_unless_present = "release"
685 )]
686 pub tag: Option<String>,
687 #[arg(
689 long = "repo",
690 default_value = "ghcr.io/greenticai/greentic-versions/gtc"
691 )]
692 pub repo: String,
693 #[arg(long = "token")]
695 pub token: Option<String>,
696}
697
698#[derive(Args, Debug)]
699pub struct ReleaseLatestArgs {
700 #[arg(
702 long = "repo",
703 default_value = "ghcr.io/greenticai/greentic-versions/gtc"
704 )]
705 pub repo: String,
706 #[arg(long = "token")]
708 pub token: Option<String>,
709 #[arg(long = "dry-run")]
711 pub dry_run: bool,
712 #[arg(long = "force")]
714 pub force: bool,
715}
716
717#[derive(Args, Debug)]
718pub struct ReleasePromoteArgs {
719 #[arg(long = "release")]
721 pub release: String,
722 #[arg(long = "tag")]
724 pub tag: String,
725 #[arg(
727 long = "repo",
728 default_value = "ghcr.io/greenticai/greentic-versions/gtc"
729 )]
730 pub repo: String,
731 #[arg(long = "token")]
733 pub token: Option<String>,
734 #[arg(long = "dry-run")]
736 pub dry_run: bool,
737 #[arg(long = "no-notify-updater")]
739 pub no_notify_updater: bool,
740}
741
742#[derive(Args, Debug)]
743pub struct ReleaseSnapshotArgs {
744 #[arg(long = "release")]
746 pub release: String,
747 #[arg(long = "channel", default_value = "dev")]
749 pub channel: String,
750 #[arg(long = "tag")]
752 pub tag: Option<String>,
753 #[arg(
755 long = "repo",
756 default_value = "ghcr.io/greenticai/greentic-versions/gtc"
757 )]
758 pub repo: String,
759 #[arg(long = "token")]
761 pub token: Option<String>,
762 #[arg(long = "out", default_value = "dist/toolchains")]
764 pub out: PathBuf,
765 #[arg(long = "dry-run")]
767 pub dry_run: bool,
768 #[arg(long = "force")]
770 pub force: bool,
771 #[arg(long = "no-notify-updater")]
773 pub no_notify_updater: bool,
774}
775
776#[derive(Args, Debug)]
777pub struct ConfigSetArgs {
778 pub key: String,
780 pub value: String,
782 #[arg(long = "file")]
784 pub file: Option<PathBuf>,
785}
786
787#[derive(Args, Debug)]
788pub struct CborArgs {
789 #[arg(value_name = "PATH")]
791 pub path: PathBuf,
792}
793
794#[derive(Args, Debug, Clone)]
795pub struct CoverageArgs {
796 #[arg(long = "skip-run")]
798 pub skip_run: bool,
799}
800
801#[derive(Clone, Copy, Debug, Eq, PartialEq, clap::ValueEnum)]
802pub enum SecurityFormat {
803 Markdown,
804 Json,
805}
806
807#[derive(Args, Debug, Clone)]
808pub struct SecurityArgs {
809 #[arg(long = "format", value_enum, default_value_t = SecurityFormat::Markdown)]
811 pub format: SecurityFormat,
812 #[arg(long = "prompt")]
814 pub prompt: bool,
815 #[arg(long = "ignore-errors", alias = "no-errors")]
817 pub no_errors: bool,
818 #[arg(long = "severity")]
820 pub severity: Option<String>,
821 #[arg(long = "security-severity")]
823 pub security_severity: Option<String>,
824 #[arg(long = "state", default_value = "open")]
826 pub state: String,
827 #[arg(long = "repo")]
829 pub repo: Option<String>,
830 #[arg(long = "branch")]
832 pub branch: Option<String>,
833}
834
835#[derive(Args, Debug, Clone)]
836pub struct WizardCommand {
837 #[command(subcommand)]
838 pub command: Option<WizardSubcommand>,
839 #[command(flatten)]
840 pub launch: WizardLaunchArgs,
841}
842
843#[derive(Subcommand, Debug, Clone)]
844pub enum WizardSubcommand {
845 Validate(WizardValidateArgs),
847 Apply(WizardApplyArgs),
849}
850
851#[derive(Args, Debug, Clone)]
852pub struct WizardLaunchArgs {
853 #[arg(long = "answers")]
855 pub answers: Option<String>,
856 #[arg(long = "frontend", default_value = "json")]
858 pub frontend: String,
859 #[arg(long = "locale")]
861 pub locale: Option<String>,
862 #[arg(long = "emit-answers")]
864 pub emit_answers: Option<PathBuf>,
865 #[arg(long = "schema")]
867 pub schema: bool,
868 #[arg(long = "schema-version")]
870 pub schema_version: Option<String>,
871 #[arg(long = "migrate")]
873 pub migrate: bool,
874 #[arg(long = "out")]
876 pub out: Option<PathBuf>,
877 #[arg(long = "dry-run")]
879 pub dry_run: bool,
880 #[arg(long = "yes")]
882 pub yes: bool,
883 #[arg(long = "non-interactive")]
885 pub non_interactive: bool,
886 #[arg(long = "unsafe-commands")]
888 pub unsafe_commands: bool,
889 #[arg(long = "allow-destructive")]
891 pub allow_destructive: bool,
892}
893
894#[derive(Args, Debug, Clone)]
895pub struct WizardValidateArgs {
896 #[arg(long = "answers")]
898 pub answers: String,
899 #[arg(long = "frontend", default_value = "json")]
901 pub frontend: String,
902 #[arg(long = "locale")]
904 pub locale: Option<String>,
905 #[arg(long = "emit-answers")]
907 pub emit_answers: Option<PathBuf>,
908 #[arg(long = "schema-version")]
910 pub schema_version: Option<String>,
911 #[arg(long = "migrate")]
913 pub migrate: bool,
914 #[arg(long = "out")]
916 pub out: Option<PathBuf>,
917}
918
919#[derive(Args, Debug, Clone)]
920pub struct WizardApplyArgs {
921 #[arg(long = "answers")]
923 pub answers: String,
924 #[arg(long = "frontend", default_value = "json")]
926 pub frontend: String,
927 #[arg(long = "locale")]
929 pub locale: Option<String>,
930 #[arg(long = "emit-answers")]
932 pub emit_answers: Option<PathBuf>,
933 #[arg(long = "schema-version")]
935 pub schema_version: Option<String>,
936 #[arg(long = "migrate")]
938 pub migrate: bool,
939 #[arg(long = "out")]
941 pub out: Option<PathBuf>,
942 #[arg(long = "yes")]
944 pub yes: bool,
945 #[arg(long = "non-interactive")]
947 pub non_interactive: bool,
948 #[arg(long = "unsafe-commands")]
950 pub unsafe_commands: bool,
951 #[arg(long = "allow-destructive")]
953 pub allow_destructive: bool,
954}