From 0e4a3ad1bc37695699e36408b7b6342225b23253 Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Wed, 4 Dec 2024 01:22:44 +0100 Subject: [PATCH] fix: set a non-zero default progress interval --- src/config/progress_options.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config/progress_options.rs b/src/config/progress_options.rs index fcb201e99..0c0766c16 100644 --- a/src/config/progress_options.rs +++ b/src/config/progress_options.rs @@ -12,6 +12,12 @@ use serde_with::{serde_as, DisplayFromStr}; use rustic_core::{Progress, ProgressBars}; +mod constants { + use std::time::Duration; + + pub(super) const DEFAULT_INTERVAL: Duration = Duration::from_millis(100); +} + /// Progress Bar Config #[serde_as] #[derive(Default, Debug, Parser, Clone, Copy, Deserialize, Serialize, Merge)] @@ -22,7 +28,7 @@ pub struct ProgressOptions { #[merge(strategy=conflate::bool::overwrite_false)] pub no_progress: bool, - /// Interval to update progress bars + /// Interval to update progress bars (default: 100ms) #[clap( long, global = true, @@ -42,7 +48,8 @@ impl ProgressOptions { /// /// `Duration::ZERO` if no progress is enabled fn progress_interval(&self) -> Duration { - self.progress_interval.map_or(Duration::ZERO, |i| *i) + self.progress_interval + .map_or(constants::DEFAULT_INTERVAL, |i| *i) } /// Create a hidden progress bar