Skip to content

Commit

Permalink
completions: fix short option conflict in zsh completion
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Sep 27, 2024
1 parent b72544e commit d973e82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Library/Homebrew/completions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down

0 comments on commit d973e82

Please sign in to comment.