File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 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.
@@ -691,6 +693,20 @@ See '<cyan,bold>cargo help</> <cyan><<command>></>' for more information on a sp
691
693
} ) )
692
694
} ) . collect ( )
693
695
} ) ) )
696
+ . add ( clap_complete:: engine:: SubcommandCandidates :: new ( move || {
697
+ alias_map. iter ( )
698
+ . map ( |( alias, cmd_info) | {
699
+ let help_text = if let super :: CommandInfo :: Alias { target } = cmd_info {
700
+ let cmd_str = target. iter ( ) . map ( String :: as_str) . collect :: < Vec < _ > > ( ) . join ( " " ) ;
701
+ format ! ( "alias for {}" , cmd_str)
702
+ } else {
703
+ "alias (from config)" . to_string ( )
704
+ } ;
705
+ clap_complete:: CompletionCandidate :: new ( alias. clone ( ) )
706
+ . help ( Some ( help_text. into ( ) ) )
707
+ } )
708
+ . collect ( )
709
+ } ) )
694
710
. subcommands ( commands:: builtin ( ) )
695
711
}
696
712
You can’t perform that action at this time.
0 commit comments