Don’t use puts_columns if empty? or single item.
This commit is contained in:
parent
4bfeaaf212
commit
01d87f8107
@ -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
|
||||
|
||||
@ -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:"
|
||||
|
||||
@ -48,6 +48,7 @@ module Homebrew
|
||||
a <=> b
|
||||
end
|
||||
end
|
||||
return if full_names.empty?
|
||||
puts_columns full_names
|
||||
else
|
||||
ENV["CLICOLOR"] = nil
|
||||
|
||||
@ -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
|
||||
|
||||
@ -93,6 +93,7 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
return if uses.empty?
|
||||
puts_columns uses.map(&:full_name)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user