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)
|
def self.warn_unavailable_with_suggestion(cask_token, e)
|
||||||
exact_match, partial_matches = Search.search(cask_token)
|
exact_match, partial_matches = Search.search(cask_token)
|
||||||
errmsg = e.message
|
|
||||||
if exact_match
|
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?
|
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
|
end
|
||||||
onoe errmsg
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.help
|
def self.help
|
||||||
|
|||||||
@ -179,7 +179,7 @@ module Homebrew
|
|||||||
ofail "No similarly named formulae found."
|
ofail "No similarly named formulae found."
|
||||||
when 1
|
when 1
|
||||||
puts "This similarly named formula was found:"
|
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}"
|
puts "To install it, run:\n brew install #{formulae_search_results.first}"
|
||||||
else
|
else
|
||||||
puts "These similarly named formulae were found:"
|
puts "These similarly named formulae were found:"
|
||||||
@ -194,7 +194,7 @@ module Homebrew
|
|||||||
ofail "No formulae found in taps."
|
ofail "No formulae found in taps."
|
||||||
when 1
|
when 1
|
||||||
puts "This formula was found in a tap:"
|
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}"
|
puts "To install it, run:\n brew install #{taps_search_results.first}"
|
||||||
else
|
else
|
||||||
puts "These formulae were found in taps:"
|
puts "These formulae were found in taps:"
|
||||||
|
|||||||
@ -48,6 +48,7 @@ module Homebrew
|
|||||||
a <=> b
|
a <=> b
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return if full_names.empty?
|
||||||
puts_columns full_names
|
puts_columns full_names
|
||||||
else
|
else
|
||||||
ENV["CLICOLOR"] = nil
|
ENV["CLICOLOR"] = nil
|
||||||
|
|||||||
@ -59,9 +59,9 @@ module Homebrew
|
|||||||
query = ARGV.first
|
query = ARGV.first
|
||||||
regex = query_regexp(query)
|
regex = query_regexp(query)
|
||||||
local_results = search_formulae(regex)
|
local_results = search_formulae(regex)
|
||||||
puts_columns(local_results)
|
puts_columns(local_results) unless local_results.empty?
|
||||||
tap_results = search_taps(regex)
|
tap_results = search_taps(regex)
|
||||||
puts_columns(tap_results)
|
puts_columns(tap_results) unless tap_results.empty?
|
||||||
|
|
||||||
if $stdout.tty?
|
if $stdout.tty?
|
||||||
count = local_results.length + tap_results.length
|
count = local_results.length + tap_results.length
|
||||||
|
|||||||
@ -93,6 +93,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return if uses.empty?
|
||||||
puts_columns uses.map(&:full_name)
|
puts_columns uses.map(&:full_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user