Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/dist/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl<'a> DownloadCfg<'a> {
let progress = ProgressBar::hidden();
progress.set_style(
ProgressStyle::with_template(
"{msg:>12.bold} [{bar:30}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
"{msg:>13.bold} downloading [{bar:15}] {total_bytes} ({bytes_per_sec}, ETA: {eta})",
)
.unwrap()
.progress_chars("## "),
Expand Down Expand Up @@ -360,7 +360,7 @@ impl DownloadStatus {
*retry_time = None;
self.progress.set_style(
ProgressStyle::with_template(
"{msg:>12.bold} [{bar:30}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
"{msg:>13.bold} downloading [{bar:15}] {total_bytes} ({bytes_per_sec}, ETA: {eta})",
)
.unwrap()
.progress_chars("## "),
Expand All @@ -369,43 +369,42 @@ impl DownloadStatus {

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

pub(crate) fn failed(&self) {
self.progress.set_style(
ProgressStyle::with_template("{msg:>12.bold} download failed after {elapsed}")
.unwrap(),
ProgressStyle::with_template("{msg:>13.bold} download failed after {elapsed}").unwrap(),
);
self.progress.finish();
}

pub(crate) fn retrying(&self) {
*self.retry_time.lock().unwrap() = Some(Instant::now());
self.progress.set_style(
ProgressStyle::with_template("{msg:>12.bold} retrying download...").unwrap(),
ProgressStyle::with_template("{msg:>13.bold} retrying download...").unwrap(),
);
}

pub(crate) fn unpack<T: Read>(&self, inner: T) -> ProgressBarIter<T> {
self.progress.reset();
self.progress.set_style(
ProgressStyle::with_template(
"{msg:>12.bold} unpacking [{bar:20}] {bytes}/{total_bytes} ({bytes_per_sec}, ETA: {eta})",
"{msg:>13.bold} unpacking [{bar:15}] {total_bytes} ({bytes_per_sec}, ETA: {eta})",
)
.unwrap()
.progress_chars("## ")
.progress_chars("## "),
);
self.progress.wrap_read(inner)
}

pub(crate) fn installing(&self) {
self.progress.set_style(
ProgressStyle::with_template(
"{msg:>12.bold} installing {spinner:.green} {total_bytes:>18}",
"{msg:>13.bold} installing {spinner:.green} {total_bytes:>26}",
)
.unwrap()
.tick_chars(r"|/-\ "),
Expand All @@ -415,7 +414,7 @@ impl DownloadStatus {

pub(crate) fn installed(&self) {
self.progress.set_style(
ProgressStyle::with_template("{msg:>12.bold} installed {total_bytes:>21}").unwrap(),
ProgressStyle::with_template("{msg:>13.bold} installed {total_bytes:>29}").unwrap(),
);
self.progress.finish();
}
Expand Down