@@ -426,6 +426,7 @@ pub(crate) fn list_installed_targets(
426
426
427
427
pub ( crate ) fn list_components (
428
428
distributable : DistributableToolchain < ' _ > ,
429
+ installed_only : bool ,
429
430
) -> Result < utils:: ExitCode > {
430
431
let mut t = process ( ) . stdout ( ) . terminal ( ) ;
431
432
@@ -435,28 +436,22 @@ pub(crate) fn list_components(
435
436
let components = manifest. query_components ( distributable. desc ( ) , & config) ?;
436
437
for component in components {
437
438
let name = component. name ;
438
- if component. installed {
439
- t. attr ( terminalsource:: Attr :: Bold ) ?;
440
- writeln ! ( t. lock( ) , "{name} (installed)" ) ?;
441
- t. reset ( ) ?;
442
- } else if component. available {
443
- writeln ! ( t. lock( ) , "{name}" ) ?;
439
+ match ( component. available , component. installed , installed_only) {
440
+ ( false , _, _) | ( _, false , true ) => continue ,
441
+ ( true , true , false ) => {
442
+ t. attr ( terminalsource:: Attr :: Bold ) ?;
443
+ writeln ! ( t. lock( ) , "{name} (installed)" ) ?;
444
+ t. reset ( ) ?;
445
+ }
446
+ ( true , _, false ) | ( _, true , true ) => {
447
+ writeln ! ( t. lock( ) , "{name}" ) ?;
448
+ }
444
449
}
445
450
}
446
451
447
452
Ok ( utils:: ExitCode ( 0 ) )
448
453
}
449
454
450
- pub ( crate ) fn list_installed_components ( distributable : DistributableToolchain < ' _ > ) -> Result < ( ) > {
451
- let t = process ( ) . stdout ( ) ;
452
- for component in distributable. components ( ) ? {
453
- if component. installed {
454
- writeln ! ( t. lock( ) , "{}" , component. name) ?;
455
- }
456
- }
457
- Ok ( ( ) )
458
- }
459
-
460
455
fn print_toolchain_path (
461
456
cfg : & Cfg ,
462
457
toolchain : & str ,
0 commit comments