@@ -128,72 +128,96 @@ pub fn main() -> Result<utils::ExitCode> {
128
128
cfg. check_metadata_version ( ) ?;
129
129
130
130
Ok ( match matches. subcommand ( ) {
131
- Some ( ( "dump-testament" , _) ) => common:: dump_testament ( ) ?,
132
- Some ( ( "show" , c) ) => match c. subcommand ( ) {
133
- Some ( ( "active-toolchain" , m) ) => handle_epipe ( show_active_toolchain ( cfg, m) ) ?,
134
- Some ( ( "home" , _) ) => handle_epipe ( show_rustup_home ( cfg) ) ?,
135
- Some ( ( "profile" , _) ) => handle_epipe ( show_profile ( cfg) ) ?,
136
- Some ( ( "keys" , _) ) => handle_epipe ( show_keys ( cfg) ) ?,
137
- _ => handle_epipe ( show ( cfg, c) ) ?,
138
- } ,
139
- Some ( ( "install" , m) ) => deprecated ( "toolchain install" , cfg, m, update) ?,
140
- Some ( ( "update" , m) ) => update ( cfg, m) ?,
141
- Some ( ( "check" , _) ) => check_updates ( cfg) ?,
142
- Some ( ( "uninstall" , m) ) => deprecated ( "toolchain uninstall" , cfg, m, toolchain_remove) ?,
143
- Some ( ( "default" , m) ) => default_ ( cfg, m) ?,
144
- Some ( ( "toolchain" , c) ) => match c. subcommand ( ) {
145
- Some ( ( "install" , m) ) => update ( cfg, m) ?,
146
- Some ( ( "list" , m) ) => handle_epipe ( toolchain_list ( cfg, m) ) ?,
147
- Some ( ( "link" , m) ) => toolchain_link ( cfg, m) ?,
148
- Some ( ( "uninstall" , m) ) => toolchain_remove ( cfg, m) ?,
149
- _ => unreachable ! ( ) ,
150
- } ,
151
- Some ( ( "target" , c) ) => match c. subcommand ( ) {
152
- Some ( ( "list" , m) ) => handle_epipe ( target_list ( cfg, m) ) ?,
153
- Some ( ( "add" , m) ) => target_add ( cfg, m) ?,
154
- Some ( ( "remove" , m) ) => target_remove ( cfg, m) ?,
155
- _ => unreachable ! ( ) ,
156
- } ,
157
- Some ( ( "component" , c) ) => match c. subcommand ( ) {
158
- Some ( ( "list" , m) ) => handle_epipe ( component_list ( cfg, m) ) ?,
159
- Some ( ( "add" , m) ) => component_add ( cfg, m) ?,
160
- Some ( ( "remove" , m) ) => component_remove ( cfg, m) ?,
161
- _ => unreachable ! ( ) ,
162
- } ,
163
- Some ( ( "override" , c) ) => match c. subcommand ( ) {
164
- Some ( ( "list" , _) ) => handle_epipe ( common:: list_overrides ( cfg) ) ?,
165
- Some ( ( "set" , m) ) => override_add ( cfg, m) ?,
166
- Some ( ( "unset" , m) ) => override_remove ( cfg, m) ?,
167
- _ => unreachable ! ( ) ,
168
- } ,
169
- Some ( ( "run" , m) ) => run ( cfg, m) ?,
170
- Some ( ( "which" , m) ) => which ( cfg, m) ?,
171
- Some ( ( "doc" , m) ) => doc ( cfg, m) ?,
172
- Some ( ( "man" , m) ) => man ( cfg, m) ?,
173
- Some ( ( "self" , c) ) => match c. subcommand ( ) {
174
- Some ( ( "update" , _) ) => self_update:: update ( cfg) ?,
175
- Some ( ( "uninstall" , m) ) => self_uninstall ( m) ?,
176
- _ => unreachable ! ( ) ,
177
- } ,
178
- Some ( ( "set" , c) ) => match c. subcommand ( ) {
179
- Some ( ( "default-host" , m) ) => set_default_host_triple ( cfg, m) ?,
180
- Some ( ( "profile" , m) ) => set_profile ( cfg, m) ?,
181
- Some ( ( "auto-self-update" , m) ) => set_auto_self_update ( cfg, m) ?,
131
+ Some ( s) => match s {
132
+ ( "dump-testament" , _) => common:: dump_testament ( ) ?,
133
+ ( "show" , c) => match c. subcommand ( ) {
134
+ Some ( s) => match s {
135
+ ( "active-toolchain" , m) => handle_epipe ( show_active_toolchain ( cfg, m) ) ?,
136
+ ( "home" , _) => handle_epipe ( show_rustup_home ( cfg) ) ?,
137
+ ( "profile" , _) => handle_epipe ( show_profile ( cfg) ) ?,
138
+ ( "keys" , _) => handle_epipe ( show_keys ( cfg) ) ?,
139
+ _ => handle_epipe ( show ( cfg, c) ) ?,
140
+ } ,
141
+ None => handle_epipe ( show ( cfg, c) ) ?,
142
+ } ,
143
+ ( "install" , m) => deprecated ( "toolchain install" , cfg, m, update) ?,
144
+ ( "update" , m) => update ( cfg, m) ?,
145
+ ( "check" , _) => check_updates ( cfg) ?,
146
+ ( "uninstall" , m) => deprecated ( "toolchain uninstall" , cfg, m, toolchain_remove) ?,
147
+ ( "default" , m) => default_ ( cfg, m) ?,
148
+ ( "toolchain" , c) => match c. subcommand ( ) {
149
+ Some ( s) => match s {
150
+ ( "install" , m) => update ( cfg, m) ?,
151
+ ( "list" , m) => handle_epipe ( toolchain_list ( cfg, m) ) ?,
152
+ ( "link" , m) => toolchain_link ( cfg, m) ?,
153
+ ( "uninstall" , m) => toolchain_remove ( cfg, m) ?,
154
+ _ => unreachable ! ( ) ,
155
+ } ,
156
+ None => unreachable ! ( ) ,
157
+ } ,
158
+ ( "target" , c) => match c. subcommand ( ) {
159
+ Some ( s) => match s {
160
+ ( "list" , m) => handle_epipe ( target_list ( cfg, m) ) ?,
161
+ ( "add" , m) => target_add ( cfg, m) ?,
162
+ ( "remove" , m) => target_remove ( cfg, m) ?,
163
+ _ => unreachable ! ( ) ,
164
+ } ,
165
+ None => unreachable ! ( ) ,
166
+ } ,
167
+ ( "component" , c) => match c. subcommand ( ) {
168
+ Some ( s) => match s {
169
+ ( "list" , m) => handle_epipe ( component_list ( cfg, m) ) ?,
170
+ ( "add" , m) => component_add ( cfg, m) ?,
171
+ ( "remove" , m) => component_remove ( cfg, m) ?,
172
+ _ => unreachable ! ( ) ,
173
+ } ,
174
+ None => unreachable ! ( ) ,
175
+ } ,
176
+ ( "override" , c) => match c. subcommand ( ) {
177
+ Some ( s) => match s {
178
+ ( "list" , _) => handle_epipe ( common:: list_overrides ( cfg) ) ?,
179
+ ( "set" , m) => override_add ( cfg, m) ?,
180
+ ( "unset" , m) => override_remove ( cfg, m) ?,
181
+ _ => unreachable ! ( ) ,
182
+ } ,
183
+ None => unreachable ! ( ) ,
184
+ } ,
185
+ ( "run" , m) => run ( cfg, m) ?,
186
+ ( "which" , m) => which ( cfg, m) ?,
187
+ ( "doc" , m) => doc ( cfg, m) ?,
188
+ ( "man" , m) => man ( cfg, m) ?,
189
+ ( "self" , c) => match c. subcommand ( ) {
190
+ Some ( s) => match s {
191
+ ( "update" , _) => self_update:: update ( cfg) ?,
192
+ ( "uninstall" , m) => self_uninstall ( m) ?,
193
+ _ => unreachable ! ( ) ,
194
+ } ,
195
+ None => unreachable ! ( ) ,
196
+ } ,
197
+ ( "set" , c) => match c. subcommand ( ) {
198
+ Some ( s) => match s {
199
+ ( "default-host" , m) => set_default_host_triple ( cfg, m) ?,
200
+ ( "profile" , m) => set_profile ( cfg, m) ?,
201
+ ( "auto-self-update" , m) => set_auto_self_update ( cfg, m) ?,
202
+ _ => unreachable ! ( ) ,
203
+ } ,
204
+ None => unreachable ! ( ) ,
205
+ } ,
206
+ ( "completions" , c) => {
207
+ if let Some ( & shell) = c. get_one :: < Shell > ( "shell" ) {
208
+ output_completion_script (
209
+ shell,
210
+ c. get_one :: < CompletionCommand > ( "command" )
211
+ . copied ( )
212
+ . unwrap_or ( CompletionCommand :: Rustup ) ,
213
+ ) ?
214
+ } else {
215
+ unreachable ! ( )
216
+ }
217
+ }
182
218
_ => unreachable ! ( ) ,
183
219
} ,
184
- Some ( ( "completions" , c) ) => {
185
- if let Some ( & shell) = c. get_one :: < Shell > ( "shell" ) {
186
- ( output_completion_script (
187
- shell,
188
- c. get_one :: < CompletionCommand > ( "command" )
189
- . copied ( )
190
- . unwrap_or ( CompletionCommand :: Rustup ) ,
191
- ) ) ?
192
- } else {
193
- unreachable ! ( )
194
- }
195
- }
196
- _ => unreachable ! ( ) ,
220
+ None => unreachable ! ( ) ,
197
221
} )
198
222
}
199
223
0 commit comments