Skip to content

Commit

Permalink
Modify download example to use custom template keys
Browse files Browse the repository at this point in the history
  • Loading branch information
redzic committed Jul 9, 2021
1 parent a59eefd commit 5e545f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/download.rs
Expand Up @@ -10,7 +10,8 @@ fn main() {

let pb = ProgressBar::new(total_size);
pb.set_style(ProgressStyle::default_bar()
.template("{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({eta})")
.with_key("eta_secs", |state| format!("{:.1}s", state.eta().as_secs_f64()))
.template("{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({eta_secs} remaining)")
.progress_chars("#>-"));

while downloaded < total_size {
Expand Down

0 comments on commit 5e545f8

Please sign in to comment.