use loaders::{MultiProgress, ProgressBar, Theme};
use std::thread;
use std::time::Duration;
fn main() {
let multi = MultiProgress::new();
let batches = multi.add(ProgressBar::new(5));
let items = multi.add(ProgressBar::new(20));
batches.set_prefix("batches");
batches.set_style(Theme::Rounded.style());
items.set_prefix("items");
items.set_style(Theme::Block.style());
for batch in 1..=5 {
multi.println(&format!("processing batch {batch}"));
items.reset();
items.set_length(20);
items.set_message(format!("batch {batch}"));
for _ in 0..20 {
items.inc(1);
thread::sleep(Duration::from_millis(25));
}
items.finish_with_message(format!("batch {batch} complete"));
batches.inc(1);
}
batches.finish_with_message("all batches complete");
items.finish_with_message("all items complete");
multi.join();
}