File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -571,6 +571,8 @@ pub fn cli(gctx: &GlobalContext) -> Command {
571
571
. invalid ( style:: INVALID )
572
572
} ;
573
573
574
+ let alias_map = super :: user_defined_aliases ( gctx) ;
575
+
574
576
Command :: new ( "cargo" )
575
577
// Subcommands all count their args' display order independently (from 0),
576
578
// which makes their args interspersed with global args. This puts global args last.
@@ -697,6 +699,20 @@ See '<cyan,bold>cargo help</> <cyan><<command>></>' for more information on a sp
697
699
. map ( |t| clap_complete:: CompletionCandidate :: new ( t) )
698
700
. collect ( )
699
701
} ) )
702
+ . add ( clap_complete:: engine:: SubcommandCandidates :: new ( move || {
703
+ alias_map. iter ( )
704
+ . map ( |( alias, cmd_info) | {
705
+ let help_text = if let super :: CommandInfo :: Alias { target } = cmd_info {
706
+ let cmd_str = target. iter ( ) . map ( String :: as_str) . collect :: < Vec < _ > > ( ) . join ( " " ) ;
707
+ format ! ( "alias for {}" , cmd_str)
708
+ } else {
709
+ "alias (from config)" . to_string ( )
710
+ } ;
711
+ clap_complete:: CompletionCandidate :: new ( alias. clone ( ) )
712
+ . help ( Some ( help_text. into ( ) ) )
713
+ } )
714
+ . collect ( )
715
+ } ) )
700
716
. subcommands ( commands:: builtin ( ) )
701
717
}
702
718
You can’t perform that action at this time.
0 commit comments