From e786bb08c940358b3f979042bd0c749d51d55dba Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 2 Jun 2018 02:25:20 +0200 Subject: [PATCH] Use `search_taps` in `brew cask search`. --- Library/Homebrew/cask/lib/hbc/cli/search.rb | 24 +++------------------ 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/cli/search.rb b/Library/Homebrew/cask/lib/hbc/cli/search.rb index 3decd6bd8d..9256317413 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/search.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/search.rb @@ -1,3 +1,5 @@ +require "cmd/search" + module Hbc class CLI class Search < AbstractCommand @@ -18,26 +20,6 @@ module Hbc end end - def self.search_remote(query) - matches = begin - GitHub.search_code( - user: "Homebrew", - path: "Casks", - filename: query, - extension: "rb", - ) - rescue GitHub::Error => error - opoo "Error searching on GitHub: #{error}\n" - [] - end - - matches.map do |match| - tap = Tap.fetch(match["repository"]["full_name"]) - next if tap.installed? - "#{tap.name}/#{File.basename(match["path"], ".rb")}" - end.compact - end - def self.search(*arguments) exact_match = nil partial_matches = [] @@ -55,7 +37,7 @@ module Hbc partial_matches.delete(exact_match) end - remote_matches = search_remote(search_term) + _, remote_matches = Homebrew.search_taps(search_term, silent: true) [exact_match, partial_matches, remote_matches, search_term] end