search: Print error message to stderr when not using a tty

This commit is contained in:
William Ma 2020-10-14 13:32:09 -04:00
parent 2baabf58d4
commit 9e9e2e63e8

View File

@ -108,9 +108,8 @@ module Homebrew
puts Formatter.columns(all_casks) puts Formatter.columns(all_casks)
end end
if $stdout.tty?
count = all_formulae.count + all_casks.count count = all_formulae.count + all_casks.count
if $stdout.tty?
if (reason = MissingFormula.reason(query, silent: true)) && !local_casks.include?(query) if (reason = MissingFormula.reason(query, silent: true)) && !local_casks.include?(query)
if count.positive? if count.positive?
puts puts
@ -121,6 +120,8 @@ module Homebrew
puts "No formula or cask found for #{query.inspect}." puts "No formula or cask found for #{query.inspect}."
GitHub.print_pull_requests_matching(query) GitHub.print_pull_requests_matching(query)
end end
elsif count.zero?
$stderr.puts "No formula or cask found for #{query.inspect}."
end end
end end