linkage: simplify display logic
Move check for emptiness into the display method, avoiding repetitive checks on the call site. Closes #381. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
This commit is contained in:
parent
e65d8e17e7
commit
806cfeee18
@ -77,29 +77,16 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def display_normal_output
|
def display_normal_output
|
||||||
unless @system_dylibs.empty?
|
display_items "System libraries", @system_dylibs
|
||||||
display_items "System libraries", @system_dylibs
|
display_items "Homebrew libraries", @brewed_dylibs
|
||||||
end
|
display_items "Variable-referenced libraries", @variable_dylibs
|
||||||
unless @brewed_dylibs.empty?
|
display_items "Missing libraries", @broken_dylibs
|
||||||
display_items "Homebrew libraries", @brewed_dylibs
|
display_items "Possible undeclared dependencies", @undeclared_deps
|
||||||
end
|
|
||||||
unless @variable_dylibs.empty?
|
|
||||||
display_items "Variable-referenced libraries", @variable_dylibs
|
|
||||||
end
|
|
||||||
unless @broken_dylibs.empty?
|
|
||||||
display_items "Missing libraries", @broken_dylibs
|
|
||||||
end
|
|
||||||
unless @undeclared_deps.empty?
|
|
||||||
display_items "Possible undeclared dependencies", @undeclared_deps
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_test_output
|
def display_test_output
|
||||||
if @broken_dylibs.empty?
|
display_items "Missing libraries", @broken_dylibs
|
||||||
puts "No broken dylib links"
|
puts "No broken dylib links" if @broken_dylibs.empty?
|
||||||
else
|
|
||||||
display_items "Missing libraries", @broken_dylibs
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -107,6 +94,7 @@ module Homebrew
|
|||||||
# Display a list of things.
|
# Display a list of things.
|
||||||
# Things may either be an array, or a hash of (label -> array)
|
# Things may either be an array, or a hash of (label -> array)
|
||||||
def display_items(label, things)
|
def display_items(label, things)
|
||||||
|
return if things.empty?
|
||||||
puts "#{label}:"
|
puts "#{label}:"
|
||||||
if things.is_a? Hash
|
if things.is_a? Hash
|
||||||
things.sort.each do |list_label, list|
|
things.sort.each do |list_label, list|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user