Crates.io | rbar |
lib.rs | rbar |
version | 0.2.2 |
source | src |
created_at | 2023-04-26 22:44:52.772817 |
updated_at | 2023-06-10 19:52:42.753036 |
description | A simple, customizable loading/progress bar that gets the terminal width and automatically adjusts |
homepage | |
repository | https://sr.ht/~parkman29/rbar |
max_upload_size | |
id | 849864 |
size | 16,814 |
This is just a simple customizable loading bar that scales to the size of your terminal and has the ability to print a message
The current version is 0.2.2
The supported colors are: black, red, green, yellow, blue, magenta, cyan, & white
Anything else will result in the default terminal color
You may also use a custom ascii sequence and not use this
Color: an ansi escape code within a string, you can use get_bar_color for this
Chars: list of chars, going from left to right:
[beginning outline, filled, edge of filled, unfilled, ending outline]
The arguments are: percentage, message, message_before, bar_config
use rbar;
use std::{thread, time};
// this example makes a loading bar similar to the one used by cargo
fn main() {
for i in 0..100 {
let bar = rbar::BarConf {
color: rbar::str_to_color("default"),
chars: ['[','=','>','-',']']
};
rbar::draw_bar(i, "Loading...", false, bar);
thread::sleep(time::Duration::from_millis(100));
}
}
Output:
[=>--------------------------------] 1% Loading...
A little later...
[==================================] 100% Loading...