-
Notifications
You must be signed in to change notification settings - Fork 16
improve progress bar, add 'light' type #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@epwalsh Thank you for working on this! I am mostly interested in the light progress bar so I will focus my comments on this.
In pure Rust, I believe the below idea would actually be a very lightweight solution that would keep printing without a line return at every step (would be interesting to do a test): use std::io::{self, Write};
use std::{thread, time};
fn main() {
eprint!("Downloading [http://xx.ot] to [~/y/y] [178MiB] .");
let _ = io::stderr().flush();
for _ in 0..10 {
eprint!(".");
thread::sleep(time::Duration::from_millis(250));
let _ = io::stderr().flush();
}
eprint!(" ✓ Done!\n");
let _ = io::stderr().flush();
eprint!("Downloading [http://ww.ot] to [~/z/z] [256MiB] .");
let _ = io::stderr().flush();
for _ in 0..10 {
eprint!(".");
thread::sleep(time::Duration::from_millis(250));
let _ = io::stderr().flush();
}
eprint!(" ✓ Done!\n");
let _ = io::stderr().flush();
} |
@guillaume-be okay just made some updates. |
Looks great! |
Great, I'll do another release once I merge this so we can push it upstream 👍 |
Adds a method
CacheBuilder::progress_bar
to set the progress bar type, or to disable the progess bar entirely. The options areProgressBar::Light
andProgressBar::Full
. The default when usingcached-path
as a library isProgressBar::Light
, while the default from the command-line isProgressBar::Full
.The full progress bar looks like this:
while the light progress bar looks like this (and only updates every 5 seconds):
@guillaume-be let me know what you think.