brew/Library/Homebrew/cmd/leaves.rb
2018-03-27 14:52:47 +01:00

22 lines
463 B
Ruby

#: * `leaves`:
#: Show installed formulae that are not dependencies of another installed formula.
require "formula"
require "tab"
require "set"
module Homebrew
module_function
def leaves
installed = Formula.installed.sort
deps_of_installed = installed.flat_map do |f|
f.runtime_dependencies.map(&:to_formula).map(&:full_name)
end
leaves = installed.map(&:full_name) - deps_of_installed
leaves.each(&method(:puts))
end
end