Class SCParse::Command
In: lib/scparse.rb
Parent: Object

A command is a block of code that should have its options parsed before being executed. A command can also be a parent to subcommands.



commands  [R] 
name  [R] 
options  [RW] 
parent  [RW] 

Public Class methods

Public Instance methods

Run the main block of code for this command, first running the prerequisite block of code if supposed to do so.

Is this command supposed to run its prerequisiste block of code before executing (as defined in the constructor)?

Does this command have a given subcommand? Note: returns the command or nil, not true/false.

Does this command have any subcommands it‘s a parent to?

Return an array of parents for this command, up to but not including the uber-parent ScriptCommandParser object.

Run the prerequisite block of code

Return the uber-parent, which is a ScriptCommandParser object.

Set the main block of code for this command.

Set the block of code to run as a prerequisite to executing the command (such as bootstrapping code).

Along with showing the usage for the command, this also displays any and all the child subcommands that belong to this command.

Define the usage of this command, using the name of the command and the uber-parent ScriptCommandParser.