From cc615ef7fbfb592e7db7dfadb554cf07ca01f872 Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Mon, 23 Jan 2023 13:32:54 -0500 Subject: [PATCH] Fix `brew search` for `HOMEBREW_INSTALL_FROM_API` --- Library/Homebrew/search.rb | 4 ++++ Library/Homebrew/tap.rb | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/Library/Homebrew/search.rb b/Library/Homebrew/search.rb index 632ab6e3c2..2644affa88 100644 --- a/Library/Homebrew/search.rb +++ b/Library/Homebrew/search.rb @@ -137,6 +137,10 @@ module Homebrew c.sub(%r{^homebrew/cask.*/}, "") end + if !Tap.fetch("homebrew/cask").installed? && Homebrew::EnvConfig.install_from_api? + cask_tokens += Homebrew::API::Cask.all_casks.keys + end + results = cask_tokens.extend(Searchable) .search(string_or_regex) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index a099b65977..a6aed47cbd 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -927,6 +927,20 @@ class CoreTap < Tap def alias_file_to_name(file) file.basename.to_s end + + # @private + def aliases + return super if installed? || !Homebrew::EnvConfig.install_from_api? + + Homebrew::API::Formula.all_aliases.keys + end + + # @private + def formula_names + return super if installed? || !Homebrew::EnvConfig.install_from_api? + + Homebrew::API::Formula.all_formulae.keys + end end # Permanent configuration per {Tap} using `git-config(1)`.