Module: Rack::App::CLI::DefaultCommands::ListCommands

Extended by:
ListCommands
Included in:
ListCommands
Defined in:
lib/rack/app/cli/default_commands/list_commands.rb

Defined Under Namespace

Classes: Formatter

Constant Summary collapse

PRESERVED_KEYWORDS =
%w[help routes irb].freeze
DEFAULT_COMMANDS =
{
  'routes' => Rack::App::CLI::DefaultCommands::ShowRoutes.description,
  'help' => 'list all available command or describe a specific command',
  'irb' => Rack::App::CLI::DefaultCommands::IRB.description
}.freeze

Instance Method Summary collapse

Instance Method Details

#get_message(known_commands) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/rack/app/cli/default_commands/list_commands.rb', line 28

def get_message(known_commands)
  collection = {}
  add_default_suggestions(collection)
  add_user_defined_commands(known_commands, collection)

  [
    header,
    Formatter.new(known_commands).format(collection)
  ].join("\n")
end