PluginProbe
Depicter — Popup & Slider Builder / 1.3.2
Depicter — Popup & Slider Builder v1.3.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / vendor / symfony / console / Command / ListCommand.php

ListCommand.php in Depicter — Popup & Slider Builder 1.3.2, at vendor/symfony/console/Command/ListCommand.php

90 lines 2.5 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\InputDefinition;
17 use Symfony\Component\Console\Input\InputInterface;
18 use Symfony\Component\Console\Input\InputOption;
19 use Symfony\Component\Console\Output\OutputInterface;
20
21 /**
22 * ListCommand displays the list of all available commands for the application.
23 *
24 * @author Fabien Potencier <fabien@symfony.com>
25 */
26 class ListCommand extends Command
27 {
28 /**
29 * {@inheritdoc}
30 */
31 protected function configure()
32 {
33 $this
34 ->setName('list')
35 ->setDefinition($this->createDefinition())
36 ->setDescription('Lists commands')
37 ->setHelp(<<<'EOF'
38 The <info>%command.name%</info> command lists all commands:
39
40 <info>php %command.full_name%</info>
41
42 You can also display the commands for a specific namespace:
43
44 <info>php %command.full_name% test</info>
45
46 You can also output the information in other formats by using the <comment>--format</comment> option:
47
48 <info>php %command.full_name% --format=xml</info>
49
50 It's also possible to get raw list of commands (useful for embedding command runner):
51
52 <info>php %command.full_name% --raw</info>
53 EOF
54 )
55 ;
56 }
57
58 /**
59 * {@inheritdoc}
60 */
61 public function getNativeDefinition()
62 {
63 return $this->createDefinition();
64 }
65
66 /**
67 * {@inheritdoc}
68 */
69 protected function execute(InputInterface $input, OutputInterface $output)
70 {
71 $helper = new DescriptorHelper();
72 $helper->describe($output, $this->getApplication(), [
73 'format' => $input->getOption('format'),
74 'raw_text' => $input->getOption('raw'),
75 'namespace' => $input->getArgument('namespace'),
76 ]);
77
78 return 0;
79 }
80
81 private function createDefinition(): InputDefinition
82 {
83 return new InputDefinition([
84 new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
85 new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
86 new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
87 ]);
88 }
89 }
90