Skip to content

Commit

Permalink
warn if search excluded unofficial taps
Browse files Browse the repository at this point in the history
warn if description search exludes any formulae/casks because --eval-all
flag wasn't set
  • Loading branch information
rrotter committed Jun 29, 2024
1 parent d84246c commit dcc49cc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Library/Homebrew/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def self.search_descriptions(string_or_regex, args, search_type: :desc)
Descriptions.search(string_or_regex, search_type, cache_store, eval_all).print
end
else
unofficial = Tap.all.sum { |tap| tap.official? ? 0 : tap.formula_files.size }
if unofficial.positive?
opoo "#{unofficial} additional formula(e) in third party repositories were not searched.\n" \
"To search all formulae repeat this search with the flag `--eval-all`."
end
descriptions = Homebrew::API::Formula.all_formulae.transform_values { |data| data["desc"] }
Descriptions.search(string_or_regex, search_type, descriptions, eval_all, cache_store_hash: true).print
end
Expand All @@ -43,6 +48,11 @@ def self.search_descriptions(string_or_regex, args, search_type: :desc)
Descriptions.search(string_or_regex, search_type, cache_store, eval_all).print
end
else
unofficial = Tap.all.sum { |tap| tap.official? ? 0 : tap.cask_files.size }
if unofficial.positive?
opoo "#{unofficial} additional cask(s) in third party repositories were not searched.\n" \
"To search all casks repeat this search with the flag `--eval-all`."
end
descriptions = Homebrew::API::Cask.all_casks.transform_values { |data| data["desc"] }
Descriptions.search(string_or_regex, search_type, descriptions, eval_all, cache_store_hash: true).print
end
Expand Down

0 comments on commit dcc49cc

Please sign in to comment.