MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
HelpCommand.php
Ir para a documentação deste ficheiro.
1<?php
2
4
11
12/*
13 * This file is part of the Symfony framework.
14 *
15 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
16 *
17 * This source file is subject to the MIT license that is bundled
18 * with this source code in the file LICENSE.
19 */
20
26class HelpCommand extends Command
27{
28 protected $command;
29
33 protected function configure()
34 {
35 $this->ignoreValidationErrors = true;
36
37 $this
38 ->setDefinition(array(
39 new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
40 new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
41 ))
42 ->setName('help')
43 ->setAliases(array('?'))
44 ->setDescription('Displays help for a command')
45 ->setHelp(<<<EOF
46The <info>help</info> command displays help for a given command:
47
48 <info>./symfony help list</info>
49
50You can also output the help as XML by using the <comment>--xml</comment> option:
51
52 <info>./symfony help --xml list</info>
53EOF
54 );
55 }
56
57 public function setCommand(Command $command)
58 {
59 $this->command = $command;
60 }
61
65 protected function execute(InputInterface $input, OutputInterface $output)
66 {
67 if (null === $this->command) {
68 $this->command = $this->application->get($input->getArgument('command_name'));
69 }
70
71 if ($input->getOption('xml')) {
72 $output->writeln($this->command->asXml(), Output::OUTPUT_RAW);
73 } else {
74 $output->writeln($this->command->asText());
75 }
76 }
77}
execute(InputInterface $input, OutputInterface $output)
Definição HelpCommand.php:65