loaders 0.0.0

A fully-featured, customisable progress bar and loading indicator library for Rust CLI and terminal applications
Documentation
use loaders::{ProgressBar, ProgressStyle};
use std::thread;
use std::time::Duration;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let style = ProgressStyle::with_template(
        "[{spinner}] {prefix} ⟶ {bar:30.white/black} {pos}/{len} | {custom_label} | {msg}",
    )?
    .with_key("custom_label", |state| {
        format!("phase {}", state.pos / 10 + 1)
    });

    let pb = ProgressBar::builder()
        .length(50)
        .style(style)
        .prefix("pipeline")
        .message("starting")
        .build();

    for step in 0..50 {
        if step % 10 == 0 {
            pb.set_message(format!("phase {}", step / 10 + 1));
        }
        pb.tick();
        pb.inc(1);
        thread::sleep(Duration::from_millis(40));
    }
    pb.finish_with_message("all phases complete");
    Ok(())
}