diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 9775e80bd8..915beb71b9 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -38,6 +38,16 @@ 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 diff --git a/Library/Homebrew/extend/os/mac/search.rb b/Library/Homebrew/extend/os/mac/search.rb index cbe7a8adff..6a094d30bd 100644 --- a/Library/Homebrew/extend/os/mac/search.rb +++ b/Library/Homebrew/extend/os/mac/search.rb @@ -37,7 +37,7 @@ module Homebrew results = cask_tokens.extend(Searchable) .search(string_or_regex) - cask_names = Cask::Cask.all.map(&:full_name) + cask_names = Cask::Cask.full_names results += DidYouMean::SpellChecker.new(dictionary: cask_names) .correct(string_or_regex)