PluginProbe
WP-Stateless – Google Cloud Storage / 3.2.0
WP-Stateless – Google Cloud Storage v3.2.0
4.4.3 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.3.0 2.3.1 2.3.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 All 62 releases
wp-stateless / vendor / symfony / console / Command / HelpCommand.php

HelpCommand.php in WP-Stateless – Google Cloud Storage 3.2.0, at vendor/symfony/console/Command/HelpCommand.php

84 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Console\Command;
13
14 use Symfony\Component\Console\Helper\DescriptorHelper;
15 use Symfony\Component\Console\Input\InputArgument;
16 use Symfony\Component\Console\Input\InputInterface;
17 use Symfony\Component\Console\Input\InputOption;
18 use Symfony\Component\Console\Output\OutputInterface;
19
20 /**
21 * HelpCommand displays the help for a given command.
22 *
23 * @author Fabien Potencier <fabien@symfony.com>
24 */
25 class HelpCommand extends Command
26 {
27 private $command;
28
29 /**
30 * {@inheritdoc}
31 */
32 protected function configure()
33 {
34 $this->ignoreValidationErrors();
35
36 $this
37 ->setName('help')
38 ->setDefinition([
39 new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
40 new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
41 new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
42 ])
43 ->setDescription('Displays help for a command')
44 ->setHelp(<<<'EOF'
45 The <info>%command.name%</info> command displays help for a given command:
46
47 <info>php %command.full_name% list</info>
48
49 You can also output the help in other formats by using the <comment>--format</comment> option:
50
51 <info>php %command.full_name% --format=xml list</info>
52
53 To display the list of available commands, please use the <info>list</info> command.
54 EOF
55 )
56 ;
57 }
58
59 public function setCommand(Command $command)
60 {
61 $this->command = $command;
62 }
63
64 /**
65 * {@inheritdoc}
66 */
67 protected function execute(InputInterface $input, OutputInterface $output)
68 {
69 if (null === $this->command) {
70 $this->command = $this->getApplication()->find($input->getArgument('command_name'));
71 }
72
73 $helper = new DescriptorHelper();
74 $helper->describe($output, $this->command, [
75 'format' => $input->getOption('format'),
76 'raw_text' => $input->getOption('raw'),
77 ]);
78
79 $this->command = null;
80
81 return 0;
82 }
83 }
84