1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use clap::{Args, Parser, Subcommand, ValueEnum};

/// Command line arguments base
/// subcommands: Config, Version
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub struct JirustCliArgs {
    #[clap(subcommand)]
    pub subcmd: Commands,
}

/// Available CLI commands
/// Config, Version
#[derive(Subcommand, Debug)]
pub enum Commands {
    Config(ConfigArgs),
    Version(VersionArgs),
}

/// Available configuration command line arguments
/// cfg_act: ConfigActionValues
///    Auth, Jira, Setup, Show
///
#[derive(Args, Debug)]
pub struct ConfigArgs {
    #[arg(value_name = "auth|jira|setup|show", help_heading = "Authentication")]
    pub cfg_act: ConfigActionValues,
}

/// Available configuration action values
/// Auth, Jira, Setup, Show
#[derive(ValueEnum, Debug, Clone, Copy)]
#[value(rename_all = "kebab-case")]
pub enum ConfigActionValues {
    Auth,
    Jira,
    Setup,
    Show,
}

/// Available version command line arguments
/// version_act: VersionActionValues
///   Create, List, Update, Delete, Release, Archive
#[derive(Args, Debug)]
pub struct VersionArgs {
    #[arg(
        value_name = "create|list|update|delete|release",
        help_heading = "Jira Project version management"
    )]
    pub version_act: VersionActionValues,
    #[clap(long)]
    pub project: String,
    #[clap(long)]
    pub project_id: Option<i64>,
    #[clap(long)]
    pub version_id: Option<String>,
    #[clap(long)]
    pub version_name: Option<String>,
    #[clap(long)]
    pub version_description: Option<String>,
    #[clap(long)]
    pub version_start_date: Option<String>,
    #[clap(long)]
    pub version_release_date: Option<String>,
    #[clap(long)]
    pub version_archived: Option<bool>,
    #[clap(long)]
    pub version_released: Option<bool>,
    #[clap(long)]
    pub version_page_size: Option<i32>,
    #[clap(long)]
    pub version_page_offset: Option<i64>,
}

/// Available version action values
/// Create, List, Update, Delete, Release, Archive
#[derive(ValueEnum, Debug, Clone, Copy)]
#[value(rename_all = "kebab-case")]
pub enum VersionActionValues {
    Create,
    List,
    Update,
    Delete,
    Release,
    Archive,
}