Skip to content

Commit 649ec2c

Browse files
fix(downloads): correctly report progress for components that were already downloaded
1 parent c62682d commit 649ec2c

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/dist/download.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,12 @@ impl DownloadStatus {
269269

270270
pub(crate) fn finished(&self) {
271271
self.progress.set_style(
272-
ProgressStyle::with_template("{msg:>12.bold} downloaded {total_bytes} in {elapsed}")
273-
.unwrap(),
272+
ProgressStyle::with_template(if self.progress.position() != 0 {
273+
"{msg:>12.bold} downloaded {total_bytes} in {elapsed}"
274+
} else {
275+
"{msg:>12.bold} component already downloaded"
276+
})
277+
.unwrap(),
274278
);
275279
}
276280

@@ -290,9 +294,11 @@ impl DownloadStatus {
290294

291295
pub(crate) fn installing(&self) {
292296
self.progress.set_style(
293-
ProgressStyle::with_template(
294-
"{msg:>12.bold} downloaded {total_bytes} in {elapsed} installing now {spinner:.green}",
295-
)
297+
ProgressStyle::with_template( if self.progress.position() != 0 {
298+
"{msg:>12.bold} downloaded {total_bytes} in {elapsed} and installing {spinner:.green}"
299+
} else {
300+
"{msg:>12.bold} component already downloaded and installing {spinner:.green}"
301+
})
296302
.unwrap()
297303
.tick_chars(r"|/-\ "),
298304
);
@@ -301,8 +307,12 @@ impl DownloadStatus {
301307

302308
pub(crate) fn installed(&self) {
303309
self.progress.set_style(
304-
ProgressStyle::with_template("{msg:>12.bold} downloaded {total_bytes} and installed")
305-
.unwrap(),
310+
ProgressStyle::with_template(if self.progress.position() != 0 {
311+
"{msg:>12.bold} downloaded {total_bytes} and installed"
312+
} else {
313+
"{msg:>12.bold} component already downloaded and installed"
314+
})
315+
.unwrap(),
306316
);
307317
self.progress.finish();
308318
}

0 commit comments

Comments
 (0)