eska_presentation/arguments/build/
config.rs1use crate::localization::Localizer;
4use clap::{Args, Subcommand};
5
6#[derive(Debug, Args)]
7pub struct ConfigArgs {
8 #[command(subcommand)]
9 pub command: ConfigCommand,
10
11 #[arg(short, long, action = clap::ArgAction::Help)]
12 pub help: Option<bool>,
13}
14
15#[derive(Debug, Subcommand)]
16pub enum ConfigCommand {
17 #[command(disable_help_flag = true)]
18 Init(ConfigInitArgs),
19 #[command(disable_help_flag = true)]
20 Edit(ConfigEditArgs),
21}
22
23#[derive(Debug, Args)]
24pub struct ConfigInitArgs {
25 #[arg(short, long, action = clap::ArgAction::Help)]
26 pub help: Option<bool>,
27}
28
29#[derive(Debug, Args)]
30pub struct ConfigEditArgs {
31 #[arg(short, long, action = clap::ArgAction::Help)]
32 pub help: Option<bool>,
33}
34
35pub fn localize(command: clap::Command, localizer: &Localizer) -> clap::Command {
37 command
38 .about(localizer.text("config-about"))
39 .override_usage(localizer.text("config-usage"))
40 .mut_arg("help", |argument| argument.help(localizer.text("cli-help")))
41 .mut_subcommand("init", |command| {
42 command
43 .about(localizer.text("config-init-about"))
44 .override_usage(localizer.text("config-init-usage"))
45 .mut_arg("help", |argument| argument.help(localizer.text("cli-help")))
46 })
47 .mut_subcommand("edit", |command| {
48 command
49 .about(localizer.text("config-edit-about"))
50 .override_usage(localizer.text("config-edit-usage"))
51 .mut_arg("help", |argument| argument.help(localizer.text("cli-help")))
52 })
53}