qrega
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#[derive(Debug, Clone, Default, clap::Parser)]
|
||||
use clap::ArgGroup;
|
||||
|
||||
#[derive(Debug, Clone, clap::Parser, Default)]
|
||||
pub struct CliArgs {
|
||||
/// Configuration file path
|
||||
#[arg(long = "config", short = 'C', default_value = "./config.toml")]
|
||||
@@ -7,4 +9,71 @@ pub struct CliArgs {
|
||||
/// Output more information in logs
|
||||
#[arg(long = "verbose", short = 'v')]
|
||||
pub verbose: bool,
|
||||
|
||||
#[command(subcommand)]
|
||||
pub command: CliCommand,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, clap::Subcommand, Default)]
|
||||
pub enum CliCommand {
|
||||
/// Run command once
|
||||
#[command(
|
||||
group(
|
||||
ArgGroup::new("devs")
|
||||
.args(["all", "devices"])
|
||||
.required(true)
|
||||
)
|
||||
)]
|
||||
Run {
|
||||
/// Run on ALL devices
|
||||
#[arg(long, short = 'a')]
|
||||
all: bool,
|
||||
/// Run on all specified devices
|
||||
#[arg(long, short = 'd')]
|
||||
devices: Vec<String>,
|
||||
/// Command to run
|
||||
#[arg(long, short = 'c')]
|
||||
command: String,
|
||||
},
|
||||
/// Run command continuosly
|
||||
#[command(
|
||||
group(
|
||||
ArgGroup::new("devs")
|
||||
.args(["all", "devices"])
|
||||
.required(true)
|
||||
)
|
||||
)]
|
||||
Monitor {
|
||||
/// Run on ALL devices
|
||||
#[arg(long, short = 'a')]
|
||||
all: bool,
|
||||
/// Run on all specified devices
|
||||
#[arg(long, short = 'd')]
|
||||
devices: Vec<String>,
|
||||
/// Command to run
|
||||
#[arg(long, short = 'c')]
|
||||
command: String,
|
||||
#[arg(long, short = 'i')]
|
||||
/// Interval to run the commands at
|
||||
interval: f32,
|
||||
},
|
||||
/// Manage devices
|
||||
Device {
|
||||
#[command(subcommand)]
|
||||
command: CliDeviceCommand,
|
||||
},
|
||||
|
||||
#[default]
|
||||
#[clap(skip)]
|
||||
None,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, clap::Subcommand, Default)]
|
||||
pub enum CliDeviceCommand {
|
||||
/// List devices
|
||||
List,
|
||||
|
||||
#[default]
|
||||
#[clap(skip)]
|
||||
None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user