Commit b0d7559a by Christian Nadolle

console/Controller show help for local options

parent 05f7df30
...@@ -287,7 +287,7 @@ class HelpController extends Controller ...@@ -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 ...@@ -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 ...@@ -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 [];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment