summaryrefslogtreecommitdiff
path: root/src/backup_progress.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-02-16 09:41:47 +0200
committerLars Wirzenius <liw@liw.fi>2021-02-16 10:57:25 +0200
commitc714af9e675fe5762914c28a566e679a98a417ab (patch)
tree9c091f8fdc6a24b1e6d37af999c74b6d82dae569 /src/backup_progress.rs
parentf9f047dc18763bd37d2cf6cbd47769f7e91f976b (diff)
downloadobnam2-c714af9e675fe5762914c28a566e679a98a417ab.tar.gz
refactor: split BackupProgress into initial, increemental variants
This makes it possible to later have different progress bars for initial and incremental backup runs. However, for now the bars are identical.
Diffstat (limited to 'src/backup_progress.rs')
-rw-r--r--src/backup_progress.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/backup_progress.rs b/src/backup_progress.rs
index 6c1d3e6..d924ce1 100644
--- a/src/backup_progress.rs
+++ b/src/backup_progress.rs
@@ -6,7 +6,26 @@ pub struct BackupProgress {
}
impl BackupProgress {
- pub fn new() -> Self {
+ pub fn initial() -> Self {
+ let progress = if true {
+ ProgressBar::new(0)
+ } else {
+ ProgressBar::hidden()
+ };
+ let parts = vec![
+ "{wide_bar}",
+ "elapsed: {elapsed}",
+ "files: {pos}/{len}",
+ "current: {wide_msg}",
+ "{spinner}",
+ ];
+ progress.set_style(ProgressStyle::default_bar().template(&parts.join("\n")));
+ progress.enable_steady_tick(100);
+
+ Self { progress }
+ }
+
+ pub fn incremental() -> Self {
let progress = if true {
ProgressBar::new(0)
} else {