Method: CommandKit::Commands::ClassMethods#command
- Defined in:
- lib/command_kit/commands.rb
#command(name = nil, command_class, **kwargs) ⇒ Subcommand
Mounts a command as a sub-command.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/command_kit/commands.rb', line 144 def command(name=nil, command_class, **kwargs) name = if name then name.to_s else command_class.command_name end subcommand = Subcommand.new(command_class,**kwargs) commands[name] = subcommand subcommand.aliases.each do |alias_name| command_aliases[alias_name] = name end return subcommand end |