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 {
571571 . invalid ( style:: INVALID )
572572 } ;
573573
574+ let alias_map = super :: user_defined_aliases ( gctx) ;
575+
574576 Command :: new ( "cargo" )
575577 // Subcommands all count their args' display order independently (from 0),
576578 // 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
691693 } ) )
692694 } ) . collect ( )
693695 } ) ) )
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+ } ) )
694710 . subcommands ( commands:: builtin ( ) )
695711}
696712
You can’t perform that action at this time.
0 commit comments