Skip to content

Commit

Permalink
Fix progress bar display
Browse files Browse the repository at this point in the history
  • Loading branch information
Morganamilo committed Apr 28, 2021
1 parent 841ebb5 commit 97b2d0b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/download.rs
Expand Up @@ -293,9 +293,8 @@ pub async fn aur_pkgbuilds(config: &Config, bases: &Bases) -> Result<()> {
.await?
} else {
let total = download.len().to_string();
let truncate = cols - (80 - (total.len() * 2)).min(cols);
let template = format!(
" ({{pos:>{}}}/{{len}}) {{prefix:!}} [{{wide_bar}}]",
" ({{pos:>{}}}/{{len}}) {{prefix:45!}} [{{wide_bar}}]",
total.len()
);
let pb = ProgressBar::new(download.len() as u64);
Expand All @@ -305,10 +304,6 @@ pub async fn aur_pkgbuilds(config: &Config, bases: &Bases) -> Result<()> {
.progress_chars("-> "),
);

let mut prefix = format!("{:<100}", "");
prefix.truncate(truncate);
pb.set_prefix(&prefix);

let fetched = config
.fetch
.download_cb(&download, |cb| {
Expand All @@ -319,9 +314,7 @@ pub async fn aur_pkgbuilds(config: &Config, bases: &Bases) -> Result<()> {
.unwrap();

pb.inc(1);
let mut prefix = format!("{}{:<100}", base, "");
prefix.truncate(truncate);
pb.set_prefix(&prefix);
pb.set_prefix(&base.to_string());
})
.await?;

Expand Down

0 comments on commit 97b2d0b

Please sign in to comment.