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 545f8a7
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. " \
"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

Check warning on line 37 in Library/Homebrew/search.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/search.rb#L36-L37

Added lines #L36 - L37 were not covered by tests
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. " \
"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

Check warning on line 57 in Library/Homebrew/search.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/search.rb#L56-L57

Added lines #L56 - L57 were not covered by tests
end
Expand Down

0 comments on commit 545f8a7

Please sign in to comment.