Creates a command that requires one value out of several possibilities. For example: you may want to limit the CLI command to only allow certain databases or tables, or that the command requires a "mode" switch that can be only one of a handful of values.
// example where a table is needed
$oApp = new cliApplication('example', 'A simple example.');
$oRequest = cliRequest::getInstance()->setApplication($oApp);
$oApp->getCommandChain()
->addCommand(
new cliCommandOption(
$oRequest, 'table', array('table1', 'table2', 'table3), false, 'Select table to use'
)
)
$oApp->execute($oRequest);
public __construct($inRequest, [$inCommandName = 'option'], [$inAvailableOptions = array()], [$inIsOptional = false], [$inCommandHelp = null])
Creates a new command
public execute()
Executes the command
Tags: cli, clicommand, clicommandoption,
cli Articles