Class: Homebrew::Cmd::CommandsCmd

Inherits:
AbstractCommand show all
Defined in:
cmd/commands.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.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'cmd/commands.rb', line 23

def run
  if args.quiet?
    puts Formatter.columns(Commands.commands(aliases: args.include_aliases?))
    return
  end

  prepend_separator = T.let(false, T::Boolean)

  {
    "Built-in commands"           => Commands.internal_commands,
    "Built-in developer commands" => Commands.internal_developer_commands,
    "External commands"           => Commands.external_commands,
  }.each do |title, commands|
    next if commands.blank?

    puts if prepend_separator
    ohai title, Formatter.columns(commands)

    prepend_separator ||= true
  end
end