Refactor search_formulae.

This commit is contained in:
Markus Reiter 2018-06-07 17:57:26 +02:00
parent 1433a2a83e
commit 535babee97

View File

@ -62,18 +62,17 @@ module Homebrew
.sort .sort
results.map do |name| results.map do |name|
begin formula, canonical_full_name = begin
formula = Formulary.factory(name) f = Formulary.factory(name)
canonical_name = formula.name [f, f.full_name]
canonical_full_name = formula.full_name
rescue rescue
canonical_name = canonical_full_name = name [nil, name]
end end
# Ignore aliases from results when the full name was also found # Ignore aliases from results when the full name was also found
next if aliases.include?(name) && results.include?(canonical_full_name) next if aliases.include?(name) && results.include?(canonical_full_name)
if (HOMEBREW_CELLAR/canonical_name).directory? if formula&.any_version_installed?
pretty_installed(name) pretty_installed(name)
else else
name name