Skip to content

Commit

Permalink
fix other download message widths
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-taxiera committed Jul 14, 2024
1 parent e2c4408 commit eb814c9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/myrient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ pub fn download_rom(
resume_dl = true
}

let width = total_download_count.checked_ilog10().unwrap_or(0) as usize + 1;

if proceed_dl {
let mut request = HTTP_CLIENT
.get(url.clone())
Expand All @@ -284,18 +286,14 @@ pub fn download_rom(
ProgressStyle::with_template(
build_progress_template(
&progress_bar,
&resume_dl.then_some(local_file_size as f64)
&resume_dl.then_some(local_file_size as f64),
)
.as_str(),
)
.unwrap()
.progress_chars("=> "),
);

let width = total_download_count
.checked_ilog10()
.unwrap_or(0) as usize + 1;

title_bar.set_prefix(format!(
"{:11} {:width$}/{}: {}",
if resume_dl { "Resuming" } else { "Downloading" },
Expand Down Expand Up @@ -328,7 +326,7 @@ pub fn download_rom(
println!(
"{}",
format!(
"Downloaded {}/{}: {}",
"Downloaded {:width$}/{}: {}",
file_index, total_download_count, rom.name
)
.green()
Expand All @@ -339,7 +337,7 @@ pub fn download_rom(
println!(
"{}",
format!(
"Already DLd {}/{}: {}",
"Already DLd {:width$}/{}: {}",
file_index, total_download_count, rom.name
)
.green()
Expand Down

0 comments on commit eb814c9

Please sign in to comment.