Skip to content

Commit

Permalink
Merge pull request #13048 from hyuraku/repair_search_casks
Browse files Browse the repository at this point in the history
repair cask's fuzzy_search in `search_casks`
  • Loading branch information
MikeMcQuaid authored Apr 4, 2022
2 parents 3370929 + e486c87 commit b4a9182
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Library/Homebrew/extend/os/mac/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def search_casks(string_or_regex)
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|
Expand All @@ -44,7 +45,7 @@ def search_casks(string_or_regex)
else
cask.full_name
end
end
end.uniq
end
end

Expand Down

0 comments on commit b4a9182

Please sign in to comment.