Skip to content

Commit fd38cc5

Browse files
fix(downloads): correctly report progress for components that were already downloaded
1 parent ffff3e8 commit fd38cc5

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/cli/download_tracker.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,12 @@ impl DownloadTracker {
128128
return;
129129
};
130130
pb.set_style(
131-
ProgressStyle::with_template("{msg:>12.bold} downloaded {total_bytes} in {elapsed}")
132-
.unwrap(),
131+
ProgressStyle::with_template(if pb.position() != 0 {
132+
"{msg:>12.bold} downloaded {total_bytes} in {elapsed}"
133+
} else {
134+
"{msg:>12.bold} component already downloaded"
135+
})
136+
.unwrap(),
133137
);
134138
}
135139

@@ -165,8 +169,11 @@ impl DownloadTracker {
165169
&& let Some((pb, _)) = self.file_progress_bars.get(&key)
166170
{
167171
pb.set_style(
168-
ProgressStyle::with_template(
169-
"{msg:>12.bold} downloaded {total_bytes} in {elapsed} installing now {spinner:.green}",
172+
ProgressStyle::with_template( if pb.position() != 0 {
173+
"{msg:>12.bold} downloaded {total_bytes} in {elapsed} and installing {spinner:.green}"
174+
} else {
175+
"{msg:>12.bold} component already downloaded and installing {spinner:.green}"
176+
}
170177
)
171178
.unwrap()
172179
.tick_chars(r"|/-\ "),
@@ -186,9 +193,11 @@ impl DownloadTracker {
186193
&& let Some((pb, _)) = self.file_progress_bars.get(&key)
187194
{
188195
pb.set_style(
189-
ProgressStyle::with_template(
190-
"{msg:>12.bold} downloaded {total_bytes} and installed",
191-
)
196+
ProgressStyle::with_template(if pb.position() != 0 {
197+
"{msg:>12.bold} downloaded {total_bytes} and installed"
198+
} else {
199+
"{msg:>12.bold} component already downloaded and installed"
200+
})
192201
.unwrap(),
193202
);
194203
pb.finish();

0 commit comments

Comments
 (0)