/** * Displays the overall information of the command. * @param Controller $controller the controller instance */ protected function getCommandHelp($controller) { $controller->color = $this->color; $this->stdout("\nDESCRIPTION\n", Console::BOLD); $comment = $controller->getHelp(); if ($comment !== '') { $this->stdout("\n{$comment}\n\n"); } $actions = $this->getActions($controller); if (!empty($actions)) { $this->stdout("\nSUB-COMMANDS\n\n", Console::BOLD); $prefix = $controller->getUniqueId(); $maxlen = 5; foreach ($actions as $action) { $len = strlen($prefix . '/' . $action) + 2 + ($action === $controller->defaultAction ? 10 : 0); if ($maxlen < $len) { $maxlen = $len; } } foreach ($actions as $action) { $this->stdout('- ' . $this->ansiFormat($prefix . '/' . $action, Console::FG_YELLOW)); $len = strlen($prefix . '/' . $action) + 2; if ($action === $controller->defaultAction) { $this->stdout(' (default)', Console::FG_GREEN); $len += 10; } $summary = $controller->getActionHelpSummary($controller->createAction($action)); if ($summary !== '') { $this->stdout(str_repeat(' ', $maxlen - $len + 2) . Console::wrapText($summary, $maxlen + 2)); } $this->stdout("\n"); } $scriptName = $this->getScriptName(); $this->stdout("\nTo see the detailed information about individual sub-commands, enter:\n"); $this->stdout("\n {$scriptName} " . $this->ansiFormat('help', Console::FG_YELLOW) . ' ' . $this->ansiFormat('<sub-command>', Console::FG_CYAN) . "\n\n"); } }
/** * Displays the overall information of the command. * @param Controller $controller the controller instance */ protected function getCommandHelp($controller) { $controller->color = $this->color; $this->stdout("\nDESCRIPTION\n", Console::BOLD); $comment = $controller->getHelp(); if ($comment !== '') { $this->stdout("\n{$comment}\n\n"); } $actions = $this->getActions($controller); if (!empty($actions)) { $this->stdout("\nSUB-COMMANDS\n\n", Console::BOLD); $prefix = $controller->getUniqueId(); foreach ($actions as $action) { echo '- ' . $this->ansiFormat($prefix . '/' . $action, Console::FG_YELLOW); if ($action === $controller->defaultAction) { $this->stdout(' (default)', Console::FG_GREEN); } $summary = $controller->getActionHelpSummary($controller->createAction($action)); if ($summary !== '') { echo ': ' . $summary; } echo "\n"; } $scriptName = $this->getScriptName(); echo "\nTo see the detailed information about individual sub-commands, enter:\n"; echo "\n {$scriptName} " . $this->ansiFormat('help', Console::FG_YELLOW) . ' ' . $this->ansiFormat('<sub-command>', Console::FG_CYAN) . "\n\n"; } }