本文整理汇总了PHP中Cake\Console\ConsoleOptionParser::help方法的典型用法代码示例。如果您正苦于以下问题:PHP ConsoleOptionParser::help方法的具体用法?PHP ConsoleOptionParser::help怎么用?PHP ConsoleOptionParser::help使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Console\ConsoleOptionParser
的用法示例。
在下文中一共展示了ConsoleOptionParser::help方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _displayHelp
/**
* Display the help in the correct format
*
* @param string $command The command to get help for.
* @return int|bool
*/
protected function _displayHelp($command)
{
$format = 'text';
if (!empty($this->args[0]) && $this->args[0] === 'xml') {
$format = 'xml';
$this->_io->outputAs(ConsoleOutput::RAW);
} else {
$this->_welcome();
}
return $this->out($this->OptionParser->help($command, $format));
}
示例2: testHelpSubcommandHelp
/**
* test that help() with a command param shows the help for a subcommand
*
* @return void
*/
public function testHelpSubcommandHelp()
{
$subParser = new ConsoleOptionParser('method', false);
$subParser->addOption('connection', ['help' => 'Db connection.']);
$parser = new ConsoleOptionParser('mycommand', false);
$parser->addSubcommand('method', ['help' => 'This is another command', 'parser' => $subParser])->addOption('test', ['help' => 'A test option.']);
$result = $parser->help('method');
$expected = <<<TEXT
<info>Usage:</info>
cake mycommand method [-h] [--connection]
<info>Options:</info>
--help, -h Display this help.
--connection Db connection.
TEXT;
$this->assertTextEquals($expected, $result, 'Help is not correct.');
}