@@ -124,7 +124,7 @@ def self.show_completions_message_if_needed
124124
125125 sig { void }
126126 def self . update_shell_completions!
127- commands = Commands . commands ( external : false , aliases : true ) . sort
127+ commands = Commands . commands ( external : false ) . sort
128128
129129 puts "Writing completions to #{ COMPLETIONS_DIR } "
130130
@@ -283,7 +283,12 @@ def self.generate_bash_subcommand_completion(command)
283283
284284 sig { params ( commands : T ::Array [ String ] ) . returns ( String ) }
285285 def self . generate_bash_completion_file ( commands )
286+ commands -= Commands . internal_commands_aliases
287+
286288 variables = Variables . new (
289+ aliases : Commands ::HOMEBREW_INTERNAL_COMMAND_ALIASES . map do |alias_cmd , command |
290+ "#{ alias_cmd } ) echo \" #{ command } \" ;;"
291+ end ,
287292 completion_functions : commands . filter_map do |command |
288293 generate_bash_subcommand_completion command
289294 end ,
@@ -449,6 +454,8 @@ def self.generate_zsh_option_exclusions(command, option)
449454
450455 sig { params ( commands : T ::Array [ String ] ) . returns ( String ) }
451456 def self . generate_zsh_completion_file ( commands )
457+ commands -= Commands . internal_commands_aliases
458+
452459 variables = Variables . new (
453460 aliases : Commands ::HOMEBREW_INTERNAL_COMMAND_ALIASES . filter_map do |alias_cmd , command |
454461 alias_cmd = "'#{ alias_cmd } '" if alias_cmd . start_with? "-"
@@ -482,7 +489,8 @@ def self.generate_fish_subcommand_completion(command)
482489 return generate_fish_nested_subcommand_completion ( command , subcommands ) if subcommands . present?
483490
484491 command_description = format_description Commands . command_description ( command , short : true ) . to_s , fish : true
485- lines = if COMPLETIONS_EXCLUSION_LIST . include? ( command )
492+ lines = if COMPLETIONS_EXCLUSION_LIST . include? ( command ) ||
493+ Commands ::HOMEBREW_INTERNAL_COMMAND_ALIASES . key? ( command )
486494 [ ]
487495 else
488496 [ "__fish_brew_complete_cmd '#{ command } ' '#{ command_description } '" ]
@@ -571,7 +579,8 @@ def self.generate_fish_named_args(command, types, subcommand: nil)
571579 sig { params ( command : String , subcommands : T ::Array [ Homebrew ::CLI ::Parser ::Subcommand ] ) . returns ( String ) }
572580 def self . generate_fish_nested_subcommand_completion ( command , subcommands )
573581 command_description = format_description Commands . command_description ( command , short : true ) . to_s , fish : true
574- lines = if COMPLETIONS_EXCLUSION_LIST . include? ( command )
582+ lines = if COMPLETIONS_EXCLUSION_LIST . include? ( command ) ||
583+ Commands ::HOMEBREW_INTERNAL_COMMAND_ALIASES . key? ( command )
575584 [ ]
576585 else
577586 [ "__fish_brew_complete_cmd '#{ command } ' '#{ command_description } '" ]
@@ -615,7 +624,12 @@ def self.generate_fish_nested_subcommand_completion(command, subcommands)
615624
616625 sig { params ( commands : T ::Array [ String ] ) . returns ( String ) }
617626 def self . generate_fish_completion_file ( commands )
627+ commands -= Commands . internal_commands_aliases
628+
618629 variables = Variables . new (
630+ aliases : Commands ::HOMEBREW_INTERNAL_COMMAND_ALIASES . map do |alias_cmd , command |
631+ " case '#{ alias_cmd } '\n echo '#{ command } '"
632+ end ,
619633 completion_functions : commands . filter_map do |command |
620634 generate_fish_subcommand_completion command
621635 end ,
0 commit comments