missing: allow hiding specified formulae

This commit is contained in:
ilovezfs 2016-09-29 11:28:01 +01:00 committed by Alyssa Ross
parent ed0fffd931
commit 7fa4ffe3dc
2 changed files with 9 additions and 3 deletions

View File

@ -18,7 +18,7 @@ module Homebrew
ARGV.resolved_formulae ARGV.resolved_formulae
end end
Diagnostic.missing_deps(ff) do |name, missing| Diagnostic.missing_deps(ff, ARGV.value("hide")) do |name, missing|
print "#{name}: " if ff.size > 1 print "#{name}: " if ff.size > 1
puts missing.join(" ") puts missing.join(" ")
end end

View File

@ -7,7 +7,7 @@ require "utils/shell"
module Homebrew module Homebrew
module Diagnostic module Diagnostic
def self.missing_deps(ff) def self.missing_deps(ff, hide = nil)
missing = {} missing = {}
ff.each do |f| ff.each do |f|
missing_deps = f.recursive_dependencies do |dependent, dep| missing_deps = f.recursive_dependencies do |dependent, dep|
@ -20,7 +20,13 @@ module Homebrew
end end
missing_deps.map!(&:to_formula) missing_deps.map!(&:to_formula)
missing_deps.reject! { |d| d.installed_prefixes.any? } if hide
missing_deps.reject! do |d|
!hide.include?(d.name) && d.installed_prefixes.any?
end
else
missing_deps.reject! { |d| d.installed_prefixes.any? }
end
unless missing_deps.empty? unless missing_deps.empty?
yield f.full_name, missing_deps if block_given? yield f.full_name, missing_deps if block_given?