Add no-progress-bars feature so other packages can hide them (#66)

This commit is contained in:
Azrenbeth
2021-09-27 11:35:40 +01:00
committed by GitHub
parent a069d8765a
commit bc30942e2d
6 changed files with 34 additions and 8 deletions

View File

@@ -181,7 +181,12 @@ impl<'a> Compressor<'a> {
panic!("Can only call `create_new_tree` once");
}
let pb = ProgressBar::new(self.original_state_map.len() as u64);
let pb: ProgressBar;
if cfg!(feature = "no-progress-bars") {
pb = ProgressBar::hidden();
} else {
pb = ProgressBar::new(self.original_state_map.len() as u64);
}
pb.set_style(
ProgressStyle::default_bar().template("[{elapsed_precise}] {bar} {pos}/{len} {msg}"),
);