@@ -142,7 +142,7 @@ pub fn main() -> Result<utils::ExitCode> {
142142 ( "home" , Some ( _) ) => handle_epipe ( show_rustup_home ( cfg) ) ?,
143143 ( "profile" , Some ( _) ) => handle_epipe ( show_profile ( cfg) ) ?,
144144 ( "keys" , Some ( _) ) => handle_epipe ( show_keys ( cfg) ) ?,
145- ( _, _) => handle_epipe ( show ( cfg) ) ?,
145+ ( _, _) => handle_epipe ( show ( cfg, c ) ) ?,
146146 } ,
147147 ( "install" , Some ( m) ) => deprecated ( "toolchain install" , cfg, m, update) ?,
148148 ( "update" , Some ( m) ) => update ( cfg, m) ?,
@@ -243,6 +243,9 @@ pub(crate) fn cli() -> App<'static, 'static> {
243243 SubCommand :: with_name ( "show" )
244244 . about ( "Show the active and installed toolchains or profiles" )
245245 . after_help ( SHOW_HELP )
246+ . arg (
247+ verbose_arg ( "Enable verbose output with rustc information for all installed toolchains" ) ,
248+ )
246249 . setting ( AppSettings :: VersionlessSubcommands )
247250 . setting ( AppSettings :: DeriveDisplayOrder )
248251 . subcommand (
@@ -1056,7 +1059,9 @@ fn which(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<utils::ExitCode> {
10561059 Ok ( utils:: ExitCode ( 0 ) )
10571060}
10581061
1059- 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+
10601065 // Print host triple
10611066 {
10621067 let mut t = term2:: stdout ( ) ;
@@ -1130,6 +1135,14 @@ fn show(cfg: &Cfg) -> Result<utils::ExitCode> {
11301135 } else {
11311136 writeln ! ( t, "{}" , it) ?;
11321137 }
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+ }
11331146 }
11341147 if show_headers {
11351148 writeln ! ( t) ?
0 commit comments