Class CmdParse::Command
In: lib/cmdparse.rb
Parent: Object

Base class for the commands. This class implements all needed methods so that it can be used by the CommandParser class.

Methods

Attributes

commands  [R]  Returns the list of commands for this command.
default_command  [R]  Returns the name of the default command.
description  [RW]  A detailed description of the command
name  [R]  The name of the command
options  [RW]  The wrapper for parsing the command line options.
short_desc  [RW]  A short description of the command.
super_command  [RW]  Sets or returns the super command of this command. The super command is either a Command instance for normal commands or a CommandParser instance for the root command.

Public Class methods

Initializes the command called name. The parameter has_commands specifies if this command takes other commands as argument. The optional argument partial_commands specifies, if partial command matching should be used.

Public Instance methods

For sorting commands by name.

Adds a command to the command list if this command takes other commands as argument. If the optional parameter default is true, then this command is used when no command is specified on the command line.

Returns the CommandParser instance for this command or nil if this command was not assigned to a CommandParser instance.

Invokes the block set by set_execution_block. This method is called by the CommandParser instance if this command was specified on the command line.

Returns true if this command supports sub commands.

This method is called when the command is added to a Command instance.

Set the given block as execution block. See also: execute.

Default method for showing the help for the command.

Returns a list of super commands, ie.:

  [command, super_command, super_super_command, ...]

Defines the usage line for the command.

[Validate]