cmd/desc: fix searching.
Ensure that the cache store is populated if we pass `--eval-all`.
This commit is contained in:
parent
001bacee18
commit
28719f7fdc
@ -72,11 +72,12 @@ module Homebrew
|
||||
else
|
||||
query = args.named.join(" ")
|
||||
string_or_regex = query_regexp(query)
|
||||
eval_all = args.eval_all? || Homebrew::EnvConfig.eval_all?
|
||||
unless args.cask?
|
||||
ohai "Formulae"
|
||||
CacheStoreDatabase.use(:descriptions) do |db|
|
||||
cache_store = DescriptionCacheStore.new(db)
|
||||
Descriptions.search(string_or_regex, search_type, cache_store).print
|
||||
Descriptions.search(string_or_regex, search_type, cache_store, eval_all).print
|
||||
end
|
||||
end
|
||||
unless args.formula?
|
||||
@ -84,7 +85,7 @@ module Homebrew
|
||||
ohai "Casks"
|
||||
CacheStoreDatabase.use(:cask_descriptions) do |db|
|
||||
cache_store = CaskDescriptionCacheStore.new(db)
|
||||
Descriptions.search(string_or_regex, search_type, cache_store).print
|
||||
Descriptions.search(string_or_regex, search_type, cache_store, eval_all).print
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -33,8 +33,8 @@ class DescriptionCacheStore < CacheStore
|
||||
# If the database is empty `update!` it with all known formulae.
|
||||
#
|
||||
# @return [nil]
|
||||
def populate_if_empty!
|
||||
return unless Homebrew::EnvConfig.eval_all?
|
||||
def populate_if_empty!(eval_all: Homebrew::EnvConfig.eval_all?)
|
||||
return unless eval_all
|
||||
return unless database.empty?
|
||||
|
||||
Formula.all.each { |f| update!(f.full_name, f.desc) }
|
||||
|
||||
@ -13,8 +13,8 @@ class Descriptions
|
||||
extend Homebrew::Search
|
||||
|
||||
# Given a regex, find all formulae whose specified fields contain a match.
|
||||
def self.search(string_or_regex, field, cache_store)
|
||||
cache_store.populate_if_empty!
|
||||
def self.search(string_or_regex, field, cache_store, eval_all)
|
||||
cache_store.populate_if_empty!(eval_all: eval_all)
|
||||
|
||||
results = case field
|
||||
when :name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user