From 8f0a06f6eafa5b86916fcce4b04b754a9d20f87c Mon Sep 17 00:00:00 2001 From: Ringo Hoffmann Date: Fri, 15 Mar 2024 10:29:50 +0100 Subject: [PATCH] set `wait` to none if passed as 0 --- src/duration.rs | 4 ++++ src/main.rs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/duration.rs b/src/duration.rs index 6e6757d..f7bff63 100644 --- a/src/duration.rs +++ b/src/duration.rs @@ -16,6 +16,10 @@ impl DurationRange { pub fn is_flat(&self) -> bool { self.0 == self.1 } + + pub fn start(&self) -> &Duration { + &self.0 + } } impl FromStr for DurationRange { diff --git a/src/main.rs b/src/main.rs index 34abe2b..d6625a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -83,7 +83,10 @@ struct Args { fn main() -> Result<()> { let args = Args::parse(); - let wait: Option = args.wait.map(|v| v.parse()).transpose()?; + let wait = match args.wait.map(|v| v.parse::()).transpose()? { + Some(v) if v.start() == &Duration::from_millis(0) && v.is_flat() => None, + v => v, + }; if !args.silent && args.parallel.get() > 1 && wait.as_ref().is_some_and(|v| v.is_flat()) { println!(