diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-03-03 19:19:39 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-03-06 09:27:50 +0200 |
commit | 62f2e1583c77e1f182740f22d3cf60ac6eaab4af (patch) | |
tree | 67779847cef39475df01eee6d78654ba9061a654 | |
parent | 26366ac6e2624b0b9d855303796684bcb26eaef2 (diff) | |
download | obnam2-62f2e1583c77e1f182740f22d3cf60ac6eaab4af.tar.gz |
refactor: add constant for showing/hiding progress reporting
This is clearer than editing literal values in the functions.
Sponsored-by: author
-rw-r--r-- | src/backup_progress.rs | 6 |
1 files 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() |