cliCommandSwitch

Allows switches to be defined with help text in an application. The cliCommandSwitch like cliCommandNull is not executed and has an empty execute path. Use when you have un-documented aliases or switches that your app uses but you do not want to create a concrete command for.

For example: if in your processing command you allow specific additional features to be enabled, but you do not want to have to create individual commands for these switches, use this class to act as an identifier and for documenting what these switches do.

// a poor example of adding a switch doc.
// w would be used in the app some how
$oApp = new cliApplication('example', 'A simple example.');
$oRequest = cliRequest::getInstance()->setApplication($oApp);
$oApp->getCommandChain()
    ->addCommand(new cliCommandSwitch($oRequest, 'w', 'Does something'))
$oApp->execute($oRequest);

Methods

public __construct($inRequest, $inSwitch, $inHelpText)

Creates a new switch only command that has no execute body.

Use this generic command for any switches you want documented in your application. Specify the alias letter and help text. The command will not execute any code nor cause the app to halt. In fact any switch commands will be processed before any other commands as switches are always handled before commands.

public execute()

Executes the command


Inherited Methods

<  1  >