Class: CmdHelp

Inherits:
CmdBase show all
Defined in:
lib/shell.rb

Overview

Command help

Constant Summary collapse

NAME =
'help'
ALIASES =
['?'].freeze
ARGUMENTS =
[].freeze
DESCRIPTION =
'Help'

Instance Method Summary collapse

Methods inherited from CmdBase

#aliases, #arguments, #description, #initialize, #name

Constructor Details

This class inherits a constructor from CmdBase

Instance Method Details

#exec(_) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/shell.rb', line 113

def exec(_)
  @shell.commands.each do |command|
    cmd = []
    cmd << command.name
    cmd += command.arguments.map { |a| "<#{a}>" }
    puts format(
      '%<alias>s %<cmd>-30s %<description>s',
      {
        alias: @shell.console.cyan.bold(command.aliases.first),
        cmd: @shell.console.magenta(cmd.join(' ')),
        description: @shell.console.yellow(command.description)
      }
    )
  end
end