Class: Homebrew::Cmd::Leaves

Inherits:
AbstractCommand show all
Defined in:
cmd/leaves.rb

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, #initialize, parser

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#runvoid

This method returns an undefined value.



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'cmd/leaves.rb', line 26

def run
  leaves_list = Formula.installed - Formula.installed.flat_map(&:runtime_formula_dependencies)
  casks_runtime_dependencies = Cask::Caskroom.casks.flat_map do |cask|
    CaskDependent.new(cask).runtime_dependencies.map(&:to_formula)
  end
  leaves_list -= casks_runtime_dependencies
  leaves_list.select! { installed_on_request?(_1) } if args.installed_on_request?
  leaves_list.select! { installed_as_dependency?(_1) } if args.installed_as_dependency?

  leaves_list.map(&:full_name)
             .sort
             .each { puts(_1) }
end