From dcc49cccded6afc0d97aef428d394babe2a9b83c Mon Sep 17 00:00:00 2001 From: Ryan Rotter Date: Sat, 29 Jun 2024 02:06:22 -0400 Subject: [PATCH] warn if search excluded unofficial taps warn if description search exludes any formulae/casks because --eval-all flag wasn't set --- Library/Homebrew/search.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Library/Homebrew/search.rb b/Library/Homebrew/search.rb index 63c53e5b528fc6..dc2027edcffa9b 100644 --- a/Library/Homebrew/search.rb +++ b/Library/Homebrew/search.rb @@ -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 @@ -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