Module: CommandKit::Commands::ModuleMethods Private

Included in:
CommandKit::Commands
Defined in:
lib/command_kit/commands.rb

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

Instance Method Summary collapse

Instance Method Details

#included(context) ⇒ 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.

Extends ClassMethods or CommandKit::Commands::ModuleMethods, depending on whether CommandKit::Commands is being included into a class or a module.

Parameters:



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/command_kit/commands.rb', line 55

def included(context)
  super(context)

  if context.class == Module
    context.extend ModuleMethods
  else
    context.usage "[options] [COMMAND [ARGS...]]"
    context.argument :command, required: false,
                               desc: 'The command name to run'

    context.argument :args, required: false,
                            repeats: true,
                            desc: 'Additional arguments for the command'

    context.extend ClassMethods
    context.command Help
  end
end