@@ -142,7 +142,7 @@ pub fn main() -> Result<utils::ExitCode> {
142
142
( "home" , Some ( _) ) => handle_epipe ( show_rustup_home ( cfg) ) ?,
143
143
( "profile" , Some ( _) ) => handle_epipe ( show_profile ( cfg) ) ?,
144
144
( "keys" , Some ( _) ) => handle_epipe ( show_keys ( cfg) ) ?,
145
- ( _, _) => handle_epipe ( show ( cfg) ) ?,
145
+ ( _, _) => handle_epipe ( show ( cfg, c ) ) ?,
146
146
} ,
147
147
( "install" , Some ( m) ) => deprecated ( "toolchain install" , cfg, m, update) ?,
148
148
( "update" , Some ( m) ) => update ( cfg, m) ?,
@@ -214,10 +214,7 @@ pub(crate) fn cli() -> App<'static, 'static> {
214
214
. setting ( AppSettings :: DeriveDisplayOrder )
215
215
. setting ( AppSettings :: SubcommandRequiredElseHelp )
216
216
. arg (
217
- Arg :: with_name ( "verbose" )
218
- . help ( "Enable verbose output" )
219
- . short ( "v" )
220
- . long ( "verbose" ) ,
217
+ verbose_arg ( "Enable verbose output" ) ,
221
218
)
222
219
. arg (
223
220
Arg :: with_name ( "quiet" )
@@ -246,18 +243,17 @@ pub(crate) fn cli() -> App<'static, 'static> {
246
243
SubCommand :: with_name ( "show" )
247
244
. about ( "Show the active and installed toolchains or profiles" )
248
245
. after_help ( SHOW_HELP )
246
+ . arg (
247
+ verbose_arg ( "Enable verbose output with rustc information for all installed toolchains" ) ,
248
+ )
249
249
. setting ( AppSettings :: VersionlessSubcommands )
250
250
. setting ( AppSettings :: DeriveDisplayOrder )
251
251
. subcommand (
252
252
SubCommand :: with_name ( "active-toolchain" )
253
253
. about ( "Show the active toolchain" )
254
254
. after_help ( SHOW_ACTIVE_TOOLCHAIN_HELP )
255
255
. arg (
256
- Arg :: with_name ( "verbose" )
257
- . help ( "Enable verbose output with rustc information" )
258
- . takes_value ( false )
259
- . short ( "v" )
260
- . long ( "verbose" ) ,
256
+ verbose_arg ( "Enable verbose output with rustc information" ) ,
261
257
) ,
262
258
)
263
259
. subcommand (
@@ -360,11 +356,7 @@ pub(crate) fn cli() -> App<'static, 'static> {
360
356
SubCommand :: with_name ( "list" )
361
357
. about ( "List installed toolchains" )
362
358
. arg (
363
- Arg :: with_name ( "verbose" )
364
- . help ( "Enable verbose output with toolchain information" )
365
- . takes_value ( false )
366
- . short ( "v" )
367
- . long ( "verbose" ) ,
359
+ verbose_arg ( "Enable verbose output with toolchain information" ) ,
368
360
) ,
369
361
)
370
362
. subcommand (
@@ -746,6 +738,14 @@ pub(crate) fn cli() -> App<'static, 'static> {
746
738
)
747
739
}
748
740
741
+ fn verbose_arg < ' a , ' b > ( help : & ' b str ) -> Arg < ' a , ' b > {
742
+ Arg :: with_name ( "verbose" )
743
+ . help ( help)
744
+ . takes_value ( false )
745
+ . short ( "v" )
746
+ . long ( "verbose" )
747
+ }
748
+
749
749
fn maybe_upgrade_data ( cfg : & Cfg , m : & ArgMatches < ' _ > ) -> Result < bool > {
750
750
match m. subcommand ( ) {
751
751
( "self" , Some ( c) ) => match c. subcommand ( ) {
@@ -1059,7 +1059,9 @@ fn which(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<utils::ExitCode> {
1059
1059
Ok ( utils:: ExitCode ( 0 ) )
1060
1060
}
1061
1061
1062
- fn show ( cfg : & Cfg ) -> Result < utils:: ExitCode > {
1062
+ fn show ( cfg : & Cfg , m : & ArgMatches < ' _ > ) -> Result < utils:: ExitCode > {
1063
+ let verbose = m. is_present ( "verbose" ) ;
1064
+
1063
1065
// Print host triple
1064
1066
{
1065
1067
let mut t = term2:: stdout ( ) ;
@@ -1133,6 +1135,14 @@ fn show(cfg: &Cfg) -> Result<utils::ExitCode> {
1133
1135
} else {
1134
1136
writeln ! ( t, "{}" , it) ?;
1135
1137
}
1138
+ if verbose {
1139
+ if let Ok ( toolchain) = cfg. get_toolchain ( & it, false ) {
1140
+ writeln ! ( process( ) . stdout( ) , "{}" , toolchain. rustc_version( ) ) ?;
1141
+ }
1142
+ // To make it easy to see what rustc that belongs to what
1143
+ // toolchain we separate each pair with an extra newline
1144
+ writeln ! ( process( ) . stdout( ) ) ?;
1145
+ }
1136
1146
}
1137
1147
if show_headers {
1138
1148
writeln ! ( t) ?
0 commit comments