From d973e8213c74f8e6ca7958ca9a2510f6334c0712 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Thu, 26 Sep 2024 20:23:08 -0400 Subject: [PATCH] completions: fix short option conflict in zsh completion --- Library/Homebrew/completions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) }