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
use alloc::format;
use std::string::String;

use clap::{Parser, Subcommand};

#[must_use]
#[derive(Parser, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[command(author, version, about, long_about = None)]
pub struct Args {
    #[clap(subcommand)]
    pub subcmd: SubCommandEnum,
}

impl Args {
    pub fn parse() -> Self {
        <Self as Parser>::parse()
    }
}

#[must_use]
#[derive(Subcommand, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum SubCommandEnum {
    /// Runs a specific workflow in the workflows.toml file
    #[clap(name = "run")]
    Run(RunCommand),

    /// Initializes a new workflow.toml file
    #[clap(name = "init")]
    Init(InitCommand),
}

#[must_use]
#[derive(clap::Args, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RunCommand {
    /// Workflow to run
    #[arg(long, short, default_value_t = { "default".into() })]
    pub workflow: String,

    /// Print debug information
    #[arg(long, short, default_value_t = false)]
    pub debug: bool,
}

#[derive(clap::Args, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct InitCommand;