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

The main class for creating a command based CLI program.

Methods

add_command   new   options   options=   parse  

Attributes

banner  [RW]  A standard banner for help & version screens
handle_exceptions  [R]  Are Exceptions be handled gracefully? I.e. by printing error message and the help screen?
main_command  [R]  The top level command representing the program itself.
program_name  [RW]  The name of the program.
program_version  [RW]  The version of the program.

Public Class methods

Create a new CommandParser object. The optional argument handleExceptions specifies if the object should handle exceptions gracefully. Set partial_commands to true, if you want partial command matching for the top level commands.

Public Instance methods

Adds a top level command.

Returns the wrapper for parsing the global options.

Sets the wrapper for parsing the global options.

Parses the command line arguments. If a block is specified, the current hierarchy level and the name of the current command is yielded after the options for the level have been parsed.

[Validate]