File tree 1 file changed +9
-12
lines changed
1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -691,36 +691,33 @@ See '<cyan,bold>cargo help</> <cyan><<command>></>' for more information on a sp
691
691
} ) )
692
692
} ) . collect ( )
693
693
} ) ) )
694
- . arg ( Arg :: new ( "toolchain" )
695
- . help ( "Specifies the toolchain to use for this command" )
696
- . value_name ( "TOOLCHAIN" )
697
- . action ( ArgAction :: Set )
698
- . add ( clap_complete:: engine:: ArgValueCompleter :: new ( |partial : & OsStr | {
699
- let toolchains = get_toolchains_from_rustup ( ) ;
700
-
701
- toolchains
694
+ . add ( clap_complete:: engine:: SubcommandCandidates :: new ( || {
695
+ get_toolchains_from_rustup ( )
702
696
. into_iter ( )
703
- . filter ( |t| OsStr :: new ( t) . as_encoded_bytes ( ) . starts_with ( partial. as_encoded_bytes ( ) ) )
704
697
. map ( |t| clap_complete:: CompletionCandidate :: new ( t) )
705
698
. collect ( )
706
- } ) ) )
699
+ } ) )
707
700
. subcommands ( commands:: builtin ( ) )
708
701
}
709
702
710
703
fn get_toolchains_from_rustup ( ) -> Vec < String > {
711
704
let output = std:: process:: Command :: new ( "rustup" )
712
705
. arg ( "toolchain" )
713
706
. arg ( "list" )
707
+ . arg ( "-q" )
714
708
. output ( )
715
709
. unwrap ( ) ;
716
-
710
+
717
711
if !output. status . success ( ) {
718
712
return vec ! [ ] ;
719
713
}
720
714
721
715
let stdout = String :: from_utf8 ( output. stdout ) . unwrap ( ) ;
722
716
723
- stdout. lines ( ) . map ( |line| format ! ( "+{}" , line) ) . collect ( )
717
+ stdout
718
+ . lines ( )
719
+ . map ( |line| format ! ( "+{}" , line) )
720
+ . collect ( )
724
721
}
725
722
726
723
#[ test]
You can’t perform that action at this time.
0 commit comments