use std::{thread::sleep, time::Duration};
use utls::prog::*;
fn demonstrate_style(style_name: &str, pb: &mut PB) {
println!("\n{} style:", style_name);
for i in 0..=100 {
pb.set_current(i);
pb.disp();
sleep(Duration::from_millis(20));
}
}
fn main() {
let max = 100;
let styles = [
("Classic", PB::classic(max)),
("Modern", PB::modern(max)),
("Minimal", PB::minimal(max)),
("Fancy", PB::fancy(max)),
("ASCII", PB::ascii(max)),
("Arrows", PB::arrows(max)),
("Box Heavy", PB::box_heavy(max)),
];
println!("Progress Bar Styles");
println!("===============================");
for (name, mut pb) in styles {
demonstrate_style(name, &mut pb);
pb.finish_with_message(&format!("{} style completed!", name));
}
let mut custom_style = PBBuilder::new(max)
.style(PBStyle {
endcaps: ["<".to_string(), ">".to_string()],
bar_end: "@".to_string(),
filled: "=".to_string(),
empty: "-".to_string(),
spinner: Some(Spinner::new("★☆")),
desc: "Custom".to_string(),
message: " {p}% Complete".to_string(),
prec: 1,
})
.width(40)
.build();
demonstrate_style("Custom", &mut custom_style);
custom_style.finish_with_message("Custom style completed!");
println!("\nAll styles demonstrated!");
}