diff --git a/Library/Homebrew/completions.rb b/Library/Homebrew/completions.rb index af795741cb4651..69cd8b42a0eff7 100644 --- a/Library/Homebrew/completions.rb +++ b/Library/Homebrew/completions.rb @@ -265,10 +265,10 @@ def self.generate_zsh_subcommand_completion(command) end def self.generate_zsh_option_exclusions(command, option) - conflicts = Commands.option_conflicts(command, option.gsub(/^--/, "")) + conflicts = Commands.option_conflicts(command, option.gsub(/^--?/, "")) return "" unless conflicts.presence - "(#{conflicts.map { |conflict| "--#{conflict}" }.join(" ")})" + "(#{conflicts.map { |conflict| "-#{"-" if conflict.size > 1}#{conflict}" }.join(" ")})" end sig { params(commands: T::Array[String]).returns(String) }