mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
search: optimize cask search
This commit is contained in:
parent
de5a13b94f
commit
4c484ec6cb
@ -31,9 +31,16 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
results = Cask::Cask.search(string_or_regex, &:token).sort_by(&:token)
|
cask_tokens = Tap.flat_map(&:cask_tokens)
|
||||||
|
|
||||||
results.map do |cask|
|
results = cask_tokens.extend(Searchable)
|
||||||
|
.search(string_or_regex)
|
||||||
|
|
||||||
|
results |= DidYouMean::SpellChecker.new(dictionary: cask_tokens)
|
||||||
|
.correct(string_or_regex)
|
||||||
|
|
||||||
|
results.sort.map do |name|
|
||||||
|
cask = Cask::CaskLoader.load(name)
|
||||||
if cask.installed?
|
if cask.installed?
|
||||||
pretty_installed(cask.token)
|
pretty_installed(cask.token)
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user