use loaders::spinner::frames::BOUNCE;
use loaders::{Color, ColorSpec, ProgressBar, ProgressStyle};
use std::thread;
use std::time::Duration;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let style = ProgressStyle::with_template(
"{prefix:.bold.green} {bar:50.cyan/blue} {pos}/{len} [{percent}%] {msg}",
)?
.progress_chars("=>-");
let pb = ProgressBar::new(100);
pb.set_style(style);
pb.set_prefix("build");
pb.set_message("custom bar");
for _ in 0..100 {
pb.inc(1);
thread::sleep(Duration::from_millis(10));
}
pb.finish_with_message("styled!");
let spinner_style = ProgressStyle::default_spinner()
.tick_strings(&BOUNCE)
.color(ColorSpec::new().set_fg(Color::Cyan).set_bold(true));
let spinner = ProgressBar::new_spinner();
spinner.set_style(spinner_style);
spinner.set_message("custom spinner frames");
spinner.enable_steady_tick(Duration::from_millis(90));
thread::sleep(Duration::from_secs(2));
spinner.finish_with_message("spinner done");
Ok(())
}