9 releases

0.1.5 Feb 10, 2023
0.1.3 Feb 7, 2023
0.0.4 Feb 5, 2023

#514 in Command-line interface

28 downloads per month

MIT license

6KB
94 lines

kbar

A progrss bar for cli. See Timer which is built using this library.

Example:

  • Simple
use kbar::Bar;
use std::thread::sleep;
use std::time::Duration;

fn main() {
    let mut bar = Bar::new();
    bar.set_job_label("Percentage");

    for i in 0..101 {
        sleep(Duration::from_millis(100));
        bar.reach_percent(i);
    }
}
  • Custom
use kbar::Bar;
use std::thread::sleep;
use std::time::Duration;

fn main() {
    let mut bar = Bar::custom(
        // left cap symbol
        String::from("["),
        // right cap symbol
        String::from("]"),
        // filled symbol
        String::from("#"),
        // empty symbol
        String::from("-"),
    );

    bar.set_job_label("Percentage");

    for i in 0..101 {
        sleep(Duration::from_millis(100));
        bar.reach_percent(i);
    }
}

Dependencies

~220KB