diff options
author | nasa <htilcs1115@gmail.com> | 2022-10-25 01:40:27 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-24 18:40:27 +0200 |
commit | 7a65b8e8dae8660f0e40130ba5a63f6c10d358c6 (patch) | |
tree | 252b6b577dcc3ef1e9958acfc68caf21e0b1628d /cli/progress_bar.rs | |
parent | 302590015d4f1b0e988ec345b4883f7cfcef7900 (diff) |
fix(cli): Fixed bug where the progress bar did not clear (#16401)
Diffstat (limited to 'cli/progress_bar.rs')
-rw-r--r-- | cli/progress_bar.rs | 14 |
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(); + } } |