Merge pull request #13048 from hyuraku/repair_search_casks

repair cask's fuzzy_search in `search_casks`
This commit is contained in:
Mike McQuaid 2022-04-04 13:40:18 +01:00 committed by GitHub
commit b4a9182e3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,8 @@ module Homebrew
results = cask_tokens.extend(Searchable)
.search(string_or_regex)
results |= DidYouMean::SpellChecker.new(dictionary: cask_tokens)
cask_names = Cask::Cask.all.map(&:full_name)
results += DidYouMean::SpellChecker.new(dictionary: cask_names)
.correct(string_or_regex)
results.sort.map do |name|
@ -44,7 +45,7 @@ module Homebrew
else
cask.full_name
end
end
end.uniq
end
end