Method: CommandKit::Commands::AutoLoad#command

Defined in:
lib/command_kit/commands/auto_load.rb

#command(name, constant, file, **kwargs) ⇒ Object

Defines an auto-loaded command mapping.

Parameters:

  • name (#to_s)

    The name of the command.

  • constant (String)

    The constant name of the command class.

  • file (String)

    The file name of the command class.

  • kwargs (Hash{Symbol => Object})

    Keyword arguments.

Options Hash (**kwargs):

  • summary (String, nil)

    An optional summary for the command.

  • aliases (Array<String>)

    Optional alias names for the subcommand.



119
120
121
122
123
124
125
# File 'lib/command_kit/commands/auto_load.rb', line 119

def command(name, constant, file, **kwargs)
  @commands[name.to_s] = Subcommand.new(
    "#{@namespace}::#{constant}",
    join(file),
    **kwargs
  )
end