diff --git a/Library/Homebrew/cask/lib/hbc/cli/search.rb b/Library/Homebrew/cask/lib/hbc/cli/search.rb index 9d1a16f157..643d18d554 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/search.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/search.rb @@ -46,6 +46,11 @@ module Hbc end def self.render_results(exact_match, partial_matches, remote_matches, search_term) + unless $stdout.tty? + puts [*exact_match, *partial_matches, *remote_matches] + return + end + if !exact_match && partial_matches.empty? puts "No Cask found for \"#{search_term}\"." return diff --git a/Library/Homebrew/test/cask/cli/search_spec.rb b/Library/Homebrew/test/cask/cli/search_spec.rb index 00fcf73824..c382614a46 100644 --- a/Library/Homebrew/test/cask/cli/search_spec.rb +++ b/Library/Homebrew/test/cask/cli/search_spec.rb @@ -1,4 +1,8 @@ describe Hbc::CLI::Search, :cask do + before(:each) do + allow($stdout).to receive(:tty?).and_return(true) + end + it "lists the available Casks that match the search term" do expect { Hbc::CLI::Search.run("local")