Class: Homebrew::Cmd::Leaves Private

Inherits:
AbstractCommand show all
Defined in:
cmd/leaves.rb,
sorbet/rbi/dsl/homebrew/cmd/leaves.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Defined Under Namespace

Classes: Args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::Cmd::Leaves::Args

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
# File 'sorbet/rbi/dsl/homebrew/cmd/leaves.rbi', line 10

def args; end

#runvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

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