* * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ /** * ListTask displays the list of all available tasks for the application. * * @package symfony * @subpackage cli * @author Fabien Potencier */ class ListTask extends Task { /** * @see Task */ protected function configure() { $this ->setDefinition(array( new Argument('namespace', Argument::OPTIONAL, 'The namespace name'), new Option('xml', null, Option::PARAMETER_NONE, 'To output help as XML'), )) ->setName('list') ->setDescription('Lists tasks') ->setHelp(<<list task lists all tasks: ./symfony list You can also display the tasks for a specific namespace: ./symfony list test You can also output the information as XML by using the --xml option: ./symfony list --xml EOF ); } /** * @see Task */ protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('xml')) { $output->write($this->application->asXml($input->getArgument('namespace')), Output::OUTPUT_RAW); } else { $output->write($this->application->asText($input->getArgument('namespace'))); } } }