Module: Mwc::Utils::CommandRegistry::ClassMethods

Defined in:
lib/mwc/utils/command_registry.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#add_command(command) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add command to thor

Parameters:

  • command (Class)

    the command to add

Since:

  • 0.1.0



20
21
22
23
24
25
26
27
28
# File 'lib/mwc/utils/command_registry.rb', line 20

def add_command(command)
  return unless command.display?

  command.options.each { |args| method_option(*args) }
  register command,
           command.name,
           command.usage,
           command.description
end

#add_subcommand(command) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add subcommand to thor

Parameters:

  • command (Class)

    the subcommand

Since:

  • 0.1.0



36
37
38
39
40
41
# File 'lib/mwc/utils/command_registry.rb', line 36

def add_subcommand(command)
  return unless command.display?

  desc command.usage, command.description
  subcommand command.name, command
end