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:
parent
0193caac2e
commit
3aac0fef7e
@ -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
|
||||
|
||||
|
||||
@ -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|
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user