Closed eatradish closed 2 months ago
I'm using indicatif as a progress bar control in one of my projects, and I'm using Multiprogress, where the style is as follows: (It actually acts as a download manager here, showing a total progress as well as the download progress of each task)
/// oma style progress bar pub fn oma_style_pb(writer: Writer, is_global: bool) -> ProgressStyle { let bar_template = { let max_len = writer.get_length(); if is_global { if max_len < 100 { " {prefix:.blue.bold}".to_owned() + " {bytes:>10.green.bold} " + &style("/").green().bold().to_string() + " {total_bytes:.green.bold} " + &style("@").green().bold().to_string() + " {binary_bytes_per_sec:<10.green.bold}" } else { " {prefix:.blue.bold}".to_owned() + " {bytes:>10.green.bold} " + &style("/").green().bold().to_string() + " {total_bytes:>8.green.bold} " + &style("@").green().bold().to_string() + " {binary_bytes_per_sec:<26.green.bold}" + " {eta_precise:<10.blue.bold} [{wide_bar:.blue.bold}] {percent:>3.blue.bold}" + &style("%").blue().bold().to_string() } } else if max_len < 100 { " {msg} {percent:>3}%".to_owned() } else { " {msg:<59} {total_bytes:<11} [{wide_bar:.white/black}] {percent:>3}%".to_owned() } }; ProgressStyle::default_bar() .template(&bar_template) .unwrap() .progress_chars("=>-") }
Insert the progress bar like this:
gpb.set_prefix("Progress"); pb_map.insert(0, gpb); let pb1 = ProgressBar::new(len); pb_map.insert(1, pb);
However, during use, the top Global Progress bar is always a pinch shorter than the bottom progress bar (max_len > 100)
Did you manage to solve it?
I'm using indicatif as a progress bar control in one of my projects, and I'm using Multiprogress, where the style is as follows: (It actually acts as a download manager here, showing a total progress as well as the download progress of each task)
Insert the progress bar like this:
However, during use, the top Global Progress bar is always a pinch shorter than the bottom progress bar (max_len > 100)