diff --git a/Library/Homebrew/cask/lib/hbc/cli/install.rb b/Library/Homebrew/cask/lib/hbc/cli/install.rb index 996de8d1b5..1292ad076e 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/install.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/install.rb @@ -42,13 +42,12 @@ module Hbc def self.warn_unavailable_with_suggestion(cask_token, e) exact_match, partial_matches = Search.search(cask_token) - errmsg = e.message if exact_match - errmsg.concat(". Did you mean:\n#{exact_match}") + onoe e.message.concat(". Did you mean:\n#{exact_match}") elsif !partial_matches.empty? - errmsg.concat(". Did you mean one of:\n#{puts_columns(partial_matches.take(20))}\n") + onoe e.message.concat(". Did you mean one of:") + $stderr.puts_columns(partial_matches.take(20)) end - onoe errmsg end def self.help diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index ffb7eeab3d..209fe8bad9 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -179,7 +179,7 @@ module Homebrew ofail "No similarly named formulae found." when 1 puts "This similarly named formula was found:" - puts_columns(formulae_search_results) + puts formulae_search_results puts "To install it, run:\n brew install #{formulae_search_results.first}" else puts "These similarly named formulae were found:" @@ -194,7 +194,7 @@ module Homebrew ofail "No formulae found in taps." when 1 puts "This formula was found in a tap:" - puts_columns(taps_search_results) + puts taps_search_results puts "To install it, run:\n brew install #{taps_search_results.first}" else puts "These formulae were found in taps:" diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index 01af678a71..93c2545ad2 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -48,6 +48,7 @@ module Homebrew a <=> b end end + return if full_names.empty? puts_columns full_names else ENV["CLICOLOR"] = nil diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 8d6e5ad7c3..f0a2769295 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -59,9 +59,9 @@ module Homebrew query = ARGV.first regex = query_regexp(query) local_results = search_formulae(regex) - puts_columns(local_results) + puts_columns(local_results) unless local_results.empty? tap_results = search_taps(regex) - puts_columns(tap_results) + puts_columns(tap_results) unless tap_results.empty? if $stdout.tty? count = local_results.length + tap_results.length diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 4acf1b9f1f..66088e217c 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -93,6 +93,7 @@ module Homebrew end end + return if uses.empty? puts_columns uses.map(&:full_name) end end