Skip to content

Commit

Permalink
fix: set a non-zero default progress interval
Browse files Browse the repository at this point in the history
  • Loading branch information
aawsome committed Dec 4, 2024
1 parent f565eea commit 0e4a3ad
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/config/progress_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 0e4a3ad

Please sign in to comment.