summaryrefslogtreecommitdiff
path: root/cli/progress_bar.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/progress_bar.rs')
-rw-r--r--cli/progress_bar.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/progress_bar.rs b/cli/progress_bar.rs
index 36cdff7c6..5b49fb279 100644
--- a/cli/progress_bar.rs
+++ b/cli/progress_bar.rs
@@ -126,4 +126,18 @@ impl ProgressBar {
inner.pb = None;
}
}
+
+ pub fn clear_guard(&self) -> ClearGuard {
+ ClearGuard { pb: self.clone() }
+ }
+}
+
+pub struct ClearGuard {
+ pb: ProgressBar,
+}
+
+impl Drop for ClearGuard {
+ fn drop(&mut self) {
+ self.pb.clear();
+ }
}