Class | Cri::CommandDSL |
In: |
lib/cri/command_dsl.rb
|
Parent: | Object |
The command DSL is a class that is used for building and modifying commands.
@param [Cri::Command, nil] command The command to modify, or nil if a
new command should be created
Marks the command as hidden. Hidden commands do not show up in the list of subcommands of the parent command, unless —verbose is passed (or `:verbose => true` is passed to the {Cri::Command#help} method). This can be used to mark commands as deprecated.
@return [void]
Adds a new option with a forbidden argument to the command. If a block is given, it will be executed when the option is successfully parsed.
@param [String, Symbol] short The short option name
@param [String, Symbol] long The long option name
@param [String] desc The option description
@return [void]
@see {option}
Adds a new option to the command. If a block is given, it will be executed when the option is successfully parsed.
@param [String, Symbol] short The short option name
@param [String, Symbol] long The long option name
@param [String] desc The option description
@option params [:forbidden, :required, :optional] :argument Whether the
argument is forbidden, required or optional
@return [void]
Adds a new option with an optional argument to the command. If a block is given, it will be executed when the option is successfully parsed.
@param [String, Symbol] short The short option name
@param [String, Symbol] long The long option name
@param [String] desc The option description
@return [void]
@see {option}
Adds a new option with a required argument to the command. If a block is given, it will be executed when the option is successfully parsed.
@param [String, Symbol] short The short option name
@param [String, Symbol] long The long option name
@param [String] desc The option description
@return [void]
@see {option}
Defines the runner class for this command. Calling this will override existing run block or runner declarations (using {run} and {runner}, respectively).
@param [Class<CommandRunner>] klass The command runner class (subclass
of {CommandRunner}) that is used for executing this command.
@return [void]
Adds a subcommand to the current command. The command can either be given explicitly, or a block can be given that defines the command.
@param [Cri::Command, nil] command The command to add as a subcommand,
or nil if the block should be used to define the command that will be added as a subcommand
@return [void]