feat(cli): introduce --version flags and a dedicated --continuous option with new short aliases
This commit is contained in:
5 files changed
+47
-14
No files matched your search
@@ -10,7 +10,11 @@ use crate::shared::client::{
|
||||
pub const DEFAULT_TUI_DURATION: Duration = Duration::ZERO;
|
||||
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
#[command(name = "irtt-tui", about = "Minimal IRTT-compatible TUI client")]
|
||||
#[command(
|
||||
name = "irtt-tui",
|
||||
version,
|
||||
about = "Minimal IRTT-compatible TUI client"
|
||||
)]
|
||||
pub struct TuiArgs {
|
||||
/// Server address/host, optionally prefixed with LABEL= and suffixed with @hmac=KEY. Repeat for multi-target mode.
|
||||
#[arg(
|
||||
@@ -33,13 +37,18 @@ pub struct TuiArgs {
|
||||
|
||||
#[arg(
|
||||
long,
|
||||
short = 'd',
|
||||
default_value = "0",
|
||||
value_parser = parse_test_duration,
|
||||
help = "Test duration (e.g. 2.5s, 1m30s, 1h); use 0 for continuous mode",
|
||||
long_help = "Test duration (e.g. 2.5s, 1m30s, 500us, 100ns, 1h); use 0 for continuous mode. The TUI defaults to continuous mode."
|
||||
help = "Test duration (e.g. 2.5s, 1m30s, 1h); use --continuous for continuous mode (0 is also accepted)",
|
||||
long_help = "Test duration (e.g. 2.5s, 1m30s, 500us, 100ns, 1h); use --continuous for continuous mode (0 is also accepted). The TUI defaults to continuous mode."
|
||||
)]
|
||||
pub duration: Duration,
|
||||
|
||||
/// Run continuously until interrupted (equivalent to --duration 0).
|
||||
#[arg(long, conflicts_with = "duration")]
|
||||
pub continuous: bool,
|
||||
|
||||
#[command(flatten)]
|
||||
pub common: CommonClientArgs,
|
||||
}
|
||||
@@ -52,7 +61,11 @@ impl TuiArgs {
|
||||
pub async fn prepare(&self) -> Result<ManagedRunSetup, String> {
|
||||
prepare_managed_run(
|
||||
&self.common,
|
||||
self.duration,
|
||||
if self.continuous {
|
||||
Duration::ZERO
|
||||
} else {
|
||||
self.duration
|
||||
},
|
||||
TargetSelection {
|
||||
targets: &self.targets,
|
||||
pacing: self.pacing,
|
||||
@@ -63,7 +76,7 @@ impl TuiArgs {
|
||||
}
|
||||
|
||||
pub fn is_continuous(&self) -> bool {
|
||||
self.duration == Duration::ZERO
|
||||
self.continuous || self.duration == Duration::ZERO
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user