mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-12 03:30:12 +08:00
console/Controller show help for local options
This commit is contained in:
@@ -287,7 +287,7 @@ class HelpController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tags = $this->parseComment($method->getDocComment());
|
$tags = $this->parseComment($method->getDocComment());
|
||||||
$options = $this->getOptionHelps($controller);
|
$options = $this->getOptionHelps($controller, $actionID);
|
||||||
|
|
||||||
if ($tags['description'] !== '') {
|
if ($tags['description'] !== '') {
|
||||||
$this->stdout("\nDESCRIPTION\n", Console::BOLD);
|
$this->stdout("\nDESCRIPTION\n", Console::BOLD);
|
||||||
@@ -317,7 +317,6 @@ class HelpController extends Controller
|
|||||||
echo implode("\n\n", array_merge($required, $optional)) . "\n\n";
|
echo implode("\n\n", array_merge($required, $optional)) . "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = $this->getOptionHelps($controller);
|
|
||||||
if (!empty($options)) {
|
if (!empty($options)) {
|
||||||
$this->stdout("\nOPTIONS\n\n", Console::BOLD);
|
$this->stdout("\nOPTIONS\n\n", Console::BOLD);
|
||||||
echo implode("\n\n", $options) . "\n\n";
|
echo implode("\n\n", $options) . "\n\n";
|
||||||
@@ -360,11 +359,15 @@ class HelpController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Returns the help information about the options available for a console controller.
|
* Returns the help information about the options available for a console controller.
|
||||||
* @param Controller $controller the console controller
|
* @param Controller $controller the console controller
|
||||||
|
* @param String|null $actionID name of the action, if set include local options for that action
|
||||||
* @return array the help information about the options
|
* @return array the help information about the options
|
||||||
*/
|
*/
|
||||||
protected function getOptionHelps($controller)
|
protected function getOptionHelps($controller, $actionID = null)
|
||||||
{
|
{
|
||||||
$optionNames = $controller->globalOptions();
|
$optionNames = $controller->globalOptions();
|
||||||
|
if (! empty($actionID)) {
|
||||||
|
$optionNames = array_merge($optionNames, $controller->localOptions($actionID));
|
||||||
|
}
|
||||||
if (empty($optionNames)) {
|
if (empty($optionNames)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user