mirror of https://github.com/Trivernis/nenv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
714 B
Rust
28 lines
714 B
Rust
2 years ago
|
use std::time::Duration;
|
||
|
|
||
|
use indicatif::{ProgressBar, ProgressStyle};
|
||
|
|
||
|
pub fn progress_bar(total: u64) -> ProgressBar {
|
||
|
let pb = ProgressBar::new(total);
|
||
|
pb.set_style(
|
||
|
ProgressStyle::default_bar()
|
||
|
.template(
|
||
|
"{msg} {spinner}\n[{wide_bar}] {bytes}/{total_bytes} ({bytes_per_sec}, {eta})",
|
||
|
)
|
||
|
.unwrap(),
|
||
|
);
|
||
|
pb.enable_steady_tick(Duration::from_millis(50));
|
||
|
pb
|
||
|
}
|
||
|
|
||
|
pub fn progress_spinner() -> ProgressBar {
|
||
|
let pb = ProgressBar::new_spinner();
|
||
|
pb.set_style(
|
||
|
ProgressStyle::default_bar()
|
||
|
.template("{msg} {spinner}")
|
||
|
.unwrap(),
|
||
|
);
|
||
|
pb.enable_steady_tick(Duration::from_millis(50));
|
||
|
pb
|
||
|
}
|