Skip to content

Commit 53a3ee1

Browse files
committed
Auto merge of #1119 - matthewjasper:removing-message, r=Diggsey
Add a message when removing a component Fixes #306. The message is (for example) ``` info: removing component 'rust-std' for 'x86_64-unknown-linux-musl' ```
2 parents 0ad45aa + 4eeaab3 commit 53a3ee1

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

src/rustup-dist/src/manifestation.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ impl Manifestation {
157157

158158
// Uninstall components
159159
for component in components_to_uninstall {
160+
161+
notify_handler(Notification::RemovingComponent(&component.pkg,
162+
&self.target_triple,
163+
component.target.as_ref()));
164+
160165
tx = try!(self.uninstall_component(&component, tx, notify_handler.clone()));
161166
}
162167

src/rustup-dist/src/notifications.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub enum Notification<'a> {
2626
MissingInstalledComponent(&'a str),
2727
DownloadingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
2828
InstallingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
29+
RemovingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>),
2930
DownloadingManifest(&'a str),
3031
DownloadingLegacyManifest,
3132
ManifestChecksumFailedHack,
@@ -55,6 +56,7 @@ impl<'a> Notification<'a> {
5556
Extracting(_, _) | SignatureValid(_) |
5657
DownloadingComponent(_, _, _) |
5758
InstallingComponent(_, _, _) |
59+
RemovingComponent(_, _, _) |
5860
ComponentAlreadyInstalled(_) |
5961
ManifestChecksumFailedHack |
6062
RollingBack | DownloadingManifest(_) => NotificationLevel::Info,
@@ -105,6 +107,13 @@ impl<'a> Display for Notification<'a> {
105107
write!(f, "installing component '{}' for '{}'", c, t.unwrap())
106108
}
107109
}
110+
RemovingComponent(c, h, t) => {
111+
if Some(h) == t || t.is_none() {
112+
write!(f, "removing component '{}'", c)
113+
} else {
114+
write!(f, "removing component '{}' for '{}'", c, t.unwrap())
115+
}
116+
}
108117
DownloadingManifest(t) => write!(f, "syncing channel updates for '{}'", t),
109118
DownloadingLegacyManifest => write!(f, "manifest not found. trying legacy manifest"),
110119
ManifestChecksumFailedHack => write!(f, "update not yet available, sorry! try again later"),

tests/cli-rustup.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ info: downloading component 'rust-std'
4040
info: downloading component 'rustc'
4141
info: downloading component 'cargo'
4242
info: downloading component 'rust-docs'
43+
info: removing component 'rust-std'
44+
info: removing component 'rustc'
45+
info: removing component 'cargo'
46+
info: removing component 'rust-docs'
4347
info: installing component 'rust-std'
4448
info: installing component 'rustc'
4549
info: installing component 'cargo'
@@ -83,6 +87,10 @@ info: downloading component 'rust-std'
8387
info: downloading component 'rustc'
8488
info: downloading component 'cargo'
8589
info: downloading component 'rust-docs'
90+
info: removing component 'rust-std'
91+
info: removing component 'rustc'
92+
info: removing component 'cargo'
93+
info: removing component 'rust-docs'
8694
info: installing component 'rust-std'
8795
info: installing component 'rustc'
8896
info: installing component 'cargo'
@@ -92,6 +100,10 @@ info: downloading component 'rust-std'
92100
info: downloading component 'rustc'
93101
info: downloading component 'cargo'
94102
info: downloading component 'rust-docs'
103+
info: removing component 'rust-std'
104+
info: removing component 'rustc'
105+
info: removing component 'cargo'
106+
info: removing component 'rust-docs'
95107
info: installing component 'rust-std'
96108
info: installing component 'rustc'
97109
info: installing component 'cargo'
@@ -101,6 +113,10 @@ info: downloading component 'rust-std'
101113
info: downloading component 'rustc'
102114
info: downloading component 'cargo'
103115
info: downloading component 'rust-docs'
116+
info: removing component 'rust-std'
117+
info: removing component 'rustc'
118+
info: removing component 'cargo'
119+
info: removing component 'rust-docs'
104120
info: installing component 'rust-std'
105121
info: installing component 'rustc'
106122
info: installing component 'cargo'
@@ -130,6 +146,10 @@ info: downloading component 'rust-std'
130146
info: downloading component 'rustc'
131147
info: downloading component 'cargo'
132148
info: downloading component 'rust-docs'
149+
info: removing component 'rust-std'
150+
info: removing component 'rustc'
151+
info: removing component 'cargo'
152+
info: removing component 'rust-docs'
133153
info: installing component 'rust-std'
134154
info: installing component 'rustc'
135155
info: installing component 'cargo'
@@ -140,6 +160,10 @@ info: downloading component 'rust-std'
140160
info: downloading component 'rustc'
141161
info: downloading component 'cargo'
142162
info: downloading component 'rust-docs'
163+
info: removing component 'rust-std'
164+
info: removing component 'rustc'
165+
info: removing component 'cargo'
166+
info: removing component 'rust-docs'
143167
info: installing component 'rust-std'
144168
info: installing component 'rustc'
145169
info: installing component 'cargo'

0 commit comments

Comments
 (0)