Skip to content

Commit

Permalink
set wait to none if passed as 0
Browse files Browse the repository at this point in the history
  • Loading branch information
zekroTJA committed Mar 15, 2024
1 parent 8c9c584 commit 8f0a06f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ struct Args {
fn main() -> Result<()> {
let args = Args::parse();

let wait: Option<DurationRange> = args.wait.map(|v| v.parse()).transpose()?;
let wait = match args.wait.map(|v| v.parse::<DurationRange>()).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!(
Expand Down

0 comments on commit 8f0a06f

Please sign in to comment.