Simplify cask search

The cask_tokens and cask_names arrays here
were almost identical so we'll just use
cask_tokens for both.
This commit is contained in:
apainintheneck 2022-12-14 00:26:01 -08:00
parent 0193caac2e
commit 3aac0fef7e
2 changed files with 1 additions and 12 deletions

View File

@ -38,16 +38,6 @@ module Cask
end.compact
end
def self.full_names
Tap.flat_map do |tap|
next tap.cask_tokens.blank?
next tap.cask_tokens if tap.user == "Homebrew"
name = tap.name
tap.cask_tokens.map { |tok| "#{name}/#{tok}" }
end.flatten
end
def tap
return super if block_given? # Object#tap

View File

@ -37,8 +37,7 @@ module Homebrew
results = cask_tokens.extend(Searchable)
.search(string_or_regex)
cask_names = Cask::Cask.full_names
results += DidYouMean::SpellChecker.new(dictionary: cask_names)
results += DidYouMean::SpellChecker.new(dictionary: cask_tokens)
.correct(string_or_regex)
results.sort.map do |name|