Skip to content

Commit 538980f

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 538980f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/dist/download.rs

Lines changed: 9 additions & 10 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,43 +369,42 @@ 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}")
381-
.unwrap(),
380+
ProgressStyle::with_template("{msg:>13.bold} download failed after {elapsed}").unwrap(),
382381
);
383382
self.progress.finish();
384383
}
385384

386385
pub(crate) fn retrying(&self) {
387386
*self.retry_time.lock().unwrap() = Some(Instant::now());
388387
self.progress.set_style(
389-
ProgressStyle::with_template("{msg:>12.bold} retrying download...").unwrap(),
388+
ProgressStyle::with_template("{msg:>13.bold} retrying download...").unwrap(),
390389
);
391390
}
392391

393392
pub(crate) fn unpack<T: Read>(&self, inner: T) -> ProgressBarIter<T> {
394393
self.progress.reset();
395394
self.progress.set_style(
396395
ProgressStyle::with_template(
397-
"{msg:>12.bold} unpacking [{bar:20}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
396+
"{msg:>13.bold} unpacking [{bar:15}] {total_bytes} ({bytes_per_sec}, ETA: {eta})",
398397
)
399398
.unwrap()
400-
.progress_chars("## ")
399+
.progress_chars("## "),
401400
);
402401
self.progress.wrap_read(inner)
403402
}
404403

405404
pub(crate) fn installing(&self) {
406405
self.progress.set_style(
407406
ProgressStyle::with_template(
408-
"{msg:>12.bold} installing {spinner:.green} {total_bytes:>18}",
407+
"{msg:>13.bold} installing {spinner:.green} {total_bytes:>26}",
409408
)
410409
.unwrap()
411410
.tick_chars(r"|/-\ "),
@@ -415,7 +414,7 @@ impl DownloadStatus {
415414

416415
pub(crate) fn installed(&self) {
417416
self.progress.set_style(
418-
ProgressStyle::with_template("{msg:>12.bold} installed {total_bytes:>21}").unwrap(),
417+
ProgressStyle::with_template("{msg:>13.bold} installed {total_bytes:>29}").unwrap(),
419418
);
420419
self.progress.finish();
421420
}

0 commit comments

Comments
 (0)