aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2016-10-02 07:57:21 +0200
committerMarkus Reiter2016-10-15 17:13:38 +0200
commit01d87f810721d8e8faf4b73ff5120923fa7c88ca (patch)
treec4e9d3941758be830549b15a35b83e201b084406 /Library
parent4bfeaaf21259637c1ad1a98b479fc0e4fdaea56e (diff)
downloadbrew-01d87f810721d8e8faf4b73ff5120923fa7c88ca.tar.bz2
Don’t use `puts_columns` if `empty?` or single item.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/install.rb7
-rw-r--r--Library/Homebrew/cmd/install.rb4
-rw-r--r--Library/Homebrew/cmd/list.rb1
-rw-r--r--Library/Homebrew/cmd/search.rb4
-rw-r--r--Library/Homebrew/cmd/uses.rb1
5 files changed, 9 insertions, 8 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/install.rb b/Library/Homebrew/cask/lib/hbc/cli/install.rb
index 996de8d1b..1292ad076 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 ffb7eeab3..209fe8bad 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 01af678a7..93c2545ad 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 8d6e5ad7c..f0a276929 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 4acf1b9f1..66088e217 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