party_run/
cli.rs

1//! CLI argument handler
2use clap::{arg, command, Args, Parser, Subcommand};
3
4/// Simple local development automator
5#[derive(Parser)]
6#[command(version, about, long_about = None)]
7#[command(propagate_version = true)]
8pub struct CliArgs {
9    /// Client command
10    #[command(subcommand)]
11    pub command: CliCommands,
12}
13
14/// Possible client commands
15#[derive(Subcommand)]
16pub enum CliCommands {
17    /// party run
18    Run(RunArgs),
19
20    /// Initialise local party configuration file
21    Init(InitArgs),
22
23    /// Display configuration information
24    Info(InfoArgs),
25
26    /// Display scheduled batches information
27    Batch(BatchArgs),
28}
29
30/// Arguments for party run
31#[derive(Args)]
32pub struct RunArgs {
33    /// Party configuration file. If missing, default tasks are used
34    #[arg(short, long)]
35    pub file: Option<String>,
36
37    /// Index of task to run from the configuration file
38    #[arg(short, long)]
39    pub index: Option<usize>,
40}
41
42/// Arguments for party info
43#[derive(Args)]
44pub struct InfoArgs {
45    /// Party configuration file to describe. If missing, default tasks are used
46    #[arg(short, long)]
47    pub file: Option<String>,
48}
49
50/// Arguments for party batch
51#[derive(Args)]
52pub struct BatchArgs {
53    /// Party configuration file to describe. If missing, default tasks are used
54    #[arg(short, long)]
55    pub file: Option<String>,
56}
57
58/// Arguments for party init
59#[derive(Args)]
60pub struct InitArgs {
61    /// Party configuration file to write to during initialisation
62    #[arg(short, long)]
63    pub file: Option<String>,
64}