. */ namespace Doctrine\Common\Cli\Tasks; use Doctrine\Common\Cli\CliException; /** * CLI Task to display available commands help * * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.org * @since 2.0 * @version $Revision$ * @author Benjamin Eberlei * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel */ class HelpTask extends AbstractTask { /** * @inheritdoc */ public function buildDocumentation() { $doc = $this->getDocumentation(); $doc->setName('help') ->setDescription('Exposes helpful information about all available tasks.'); } /** * @inheritdoc */ public function extendedHelp() { $this->run(); } /** * Exposes the available tasks * */ public function run() { $this->getPrinter()->writeln('Available Tasks:', 'HEADER')->write(PHP_EOL); // Find the CLI Controller $cliController = $this->getNamespace()->getParentNamespace(); // Switch between ALL available tasks and display the basic Help of each one $availableTasks = $cliController->getAvailableTasks(); //unset($availableTasks['Core:Help']); ksort($availableTasks); foreach (array_keys($availableTasks) as $taskName) { $cliController->runTask($taskName, array('basic-help' => true)); } } }