Skip to content

Commit f8bba9e

Browse files
fix(installations): correct faulty output when interleaving a installation with a download
1 parent 8941f49 commit f8bba9e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/cli/download_tracker.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ impl DownloadTracker {
5959
self.create_progress_bar(component.to_owned(), url.to_owned());
6060
true
6161
}
62+
Notification::Install(In::InstallingComponent(component, _, _)) => {
63+
self.installing_component(component);
64+
true
65+
}
6266
_ => false,
6367
}
6468
}
@@ -104,4 +108,24 @@ impl DownloadTracker {
104108
);
105109
pb.finish();
106110
}
111+
112+
/// Notifies that the downloaded component is being installed.
113+
pub(crate) fn installing_component(&mut self, component: &str) {
114+
let key = self
115+
.file_progress_bars
116+
.keys()
117+
.find(|comp| comp.contains(component))
118+
.cloned();
119+
if let Some(key) = key
120+
&& let Some(pb) = self.file_progress_bars.get(&key)
121+
{
122+
pb.set_style(
123+
ProgressStyle::with_template(
124+
"{msg:>12.bold} downloaded {total_bytes} in {elapsed} installing now...",
125+
)
126+
.unwrap(),
127+
);
128+
pb.finish();
129+
}
130+
}
107131
}

0 commit comments

Comments
 (0)