Skip to content

Commit 3a2f749

Browse files
committed
dist: align progress bar elements
- Increase label to accomodate rust-analyzer component - Drop bytes so lines will fit within 80 columns - Shorten progress bars so lines will fit within 80 columns - Add label to download progress bar
1 parent 4ae2012 commit 3a2f749

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/dist/download.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ impl<'a> DownloadCfg<'a> {
285285
let progress = ProgressBar::hidden();
286286
progress.set_style(
287287
ProgressStyle::with_template(
288-
"{msg:>12.bold} [{bar:30}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
288+
"{msg:>13.bold} downloading [{bar:15}] {total_bytes} ({bytes_per_sec}, ETA: {eta})",
289289
)
290290
.unwrap()
291291
.progress_chars("## "),
@@ -360,7 +360,7 @@ impl DownloadStatus {
360360
*retry_time = None;
361361
self.progress.set_style(
362362
ProgressStyle::with_template(
363-
"{msg:>12.bold} [{bar:30}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
363+
"{msg:>13.bold} downloading [{bar:15}] {total_bytes} ({bytes_per_sec}, ETA: {eta})",
364364
)
365365
.unwrap()
366366
.progress_chars("## "),
@@ -369,15 +369,15 @@ impl DownloadStatus {
369369

370370
pub(crate) fn finished(&self) {
371371
self.progress.set_style(
372-
ProgressStyle::with_template("{msg:>12.bold} pending installation {total_bytes:>10}")
372+
ProgressStyle::with_template("{msg:>13.bold} pending installation {total_bytes:>18}")
373373
.unwrap(),
374374
);
375375
self.progress.tick(); // A tick is needed for the new style to appear, as it is static.
376376
}
377377

378378
pub(crate) fn failed(&self) {
379379
self.progress.set_style(
380-
ProgressStyle::with_template("{msg:>12.bold} download failed after {elapsed}")
380+
ProgressStyle::with_template("{msg:>13.bold} download failed after {elapsed}")
381381
.unwrap(),
382382
);
383383
self.progress.finish();
@@ -386,15 +386,15 @@ impl DownloadStatus {
386386
pub(crate) fn retrying(&self) {
387387
*self.retry_time.lock().unwrap() = Some(Instant::now());
388388
self.progress.set_style(
389-
ProgressStyle::with_template("{msg:>12.bold} retrying download...").unwrap(),
389+
ProgressStyle::with_template("{msg:>13.bold} retrying download...").unwrap(),
390390
);
391391
}
392392

393393
pub(crate) fn unpack<T: Read>(&self, inner: T) -> ProgressBarIter<T> {
394394
self.progress.reset();
395395
self.progress.set_style(
396396
ProgressStyle::with_template(
397-
"{msg:>12.bold} unpacking [{bar:20}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
397+
"{msg:>13.bold} unpacking [{bar:15}] {total_bytes} ({bytes_per_sec}, ETA: {eta})",
398398
)
399399
.unwrap()
400400
.progress_chars("## ")
@@ -405,7 +405,7 @@ impl DownloadStatus {
405405
pub(crate) fn installing(&self) {
406406
self.progress.set_style(
407407
ProgressStyle::with_template(
408-
"{msg:>12.bold} installing {spinner:.green} {total_bytes:>18}",
408+
"{msg:>13.bold} installing {spinner:.green} {total_bytes:>26}",
409409
)
410410
.unwrap()
411411
.tick_chars(r"|/-\ "),
@@ -415,7 +415,7 @@ impl DownloadStatus {
415415

416416
pub(crate) fn installed(&self) {
417417
self.progress.set_style(
418-
ProgressStyle::with_template("{msg:>12.bold} installed {total_bytes:>21}").unwrap(),
418+
ProgressStyle::with_template("{msg:>13.bold} installed {total_bytes:>29}").unwrap(),
419419
);
420420
self.progress.finish();
421421
}

0 commit comments

Comments
 (0)