cmd/leaves: handle missing formula.

Use `runtime_formula_dependencies` which does this for us.

Fixes #6827.
This commit is contained in:
Mike McQuaid 2019-12-10 15:44:14 +00:00
parent cf1002b8e5
commit 3f348286f9
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -22,16 +22,8 @@ module Homebrew
leaves_args.parse leaves_args.parse
installed = Formula.installed.sort installed = Formula.installed.sort
deps_of_installed = installed.flat_map(&:runtime_formula_dependencies)
deps_of_installed = installed.flat_map do |f| leaves = installed.map(&:full_name) - deps_of_installed.map(&:full_name)
f.runtime_dependencies.map do |dep|
dep.to_formula.full_name
rescue FormulaUnavailableError
dep.name
end
end
leaves = installed.map(&:full_name) - deps_of_installed
leaves.each(&method(:puts)) leaves.each(&method(:puts))
end end
end end