Class: D2::Commands::Help

Inherits:
D2::Command
  • Object
show all
Defined in:
lib/d2/commands/help.rb

Instance Method Summary collapse

Methods included from Utils::Formatter

#logger

Instance Method Details

#call(args, _name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/d2/commands/help.rb', line 6

def call(args, _name)
  logger.info "{{bold:Available commands}}"
  logger.info ""

  D2::Commands::Registry.resolved_commands.each do |name, klass|
    next if name == 'help'
    logger.info "{{command:#{D2::TOOL_NAME} #{name}}}"
    if help = klass.help
      logger.info help
    end
    logger.info ""
  end
end