From 62f2e1583c77e1f182740f22d3cf60ac6eaab4af Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 3 Mar 2022 19:19:39 +0200 Subject: refactor: add constant for showing/hiding progress reporting This is clearer than editing literal values in the functions. Sponsored-by: author --- src/backup_progress.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backup_progress.rs b/src/backup_progress.rs index 52430e4..f119210 100644 --- a/src/backup_progress.rs +++ b/src/backup_progress.rs @@ -4,6 +4,8 @@ use crate::generation::GenId; use indicatif::{ProgressBar, ProgressStyle}; use std::path::Path; +const SHOW_PROGRESS: bool = true; + /// A progress bar abstraction specific to backups. /// /// The progress bar is different for initial and incremental backups, @@ -15,7 +17,7 @@ pub struct BackupProgress { impl BackupProgress { /// Create a progress bar for an initial backup. pub fn initial() -> Self { - let progress = if true { + let progress = if SHOW_PROGRESS { ProgressBar::new(0) } else { ProgressBar::hidden() @@ -35,7 +37,7 @@ impl BackupProgress { /// Create a progress bar for an incremental backup. pub fn incremental() -> Self { - let progress = if true { + let progress = if SHOW_PROGRESS { ProgressBar::new(0) } else { ProgressBar::hidden() -- cgit v1.2.1