cargo_workflows/
args.rs

1use alloc::format;
2use std::string::String;
3
4use clap::{Parser, Subcommand};
5
6#[must_use]
7#[derive(Parser, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
8#[command(author, version, about, long_about = None)]
9pub struct Args {
10    #[clap(subcommand)]
11    pub subcmd: SubCommandEnum,
12}
13
14impl Args {
15    pub fn parse() -> Self {
16        <Self as Parser>::parse()
17    }
18}
19
20#[must_use]
21#[derive(Subcommand, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
22pub enum SubCommandEnum {
23    /// Runs a specific workflow in the workflows.toml file
24    #[clap(name = "run")]
25    Run(RunCommand),
26
27    /// Initializes a new workflow.toml file
28    #[clap(name = "init")]
29    Init(InitCommand),
30}
31
32#[must_use]
33#[derive(clap::Args, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
34pub struct RunCommand {
35    /// Workflow to run
36    #[arg(long, short, default_value_t = { "default".into() })]
37    pub workflow: String,
38
39    /// Print debug information
40    #[arg(long, short, default_value_t = false)]
41    pub debug: bool,
42}
43
44#[derive(clap::Args, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
45pub struct InitCommand;