* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Command; use Symfony\Component\Console\Completion\CompletionInput; use Symfony\Component\Console\Completion\CompletionSuggestions; use Symfony\Component\Console\Descriptor\ApplicationDescription; use Symfony\Component\Console\Helper\DescriptorHelper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** * ListCommand displays the list of all available commands for the application. * * @author Fabien Potencier */ class ListCommand extends Command { /** * {@inheritdoc} */ protected function configure() { $this ->setName('list') ->setDefinition([ new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'), ]) ->setDescription('List commands') ->setHelp(<<<'EOF' The %command.name% command lists all commands: %command.full_name% You can also display the commands for a specific namespace: %command.full_name% test You can also output the information in other formats by using the --format option: %command.full_name% --format=xml It's also possible to get raw list of commands (useful for embedding command runner): %command.full_name% --raw EOF ) ; } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $helper = new DescriptorHelper(); $helper->describe($output, $this->getApplication(), [ 'format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'namespace' => $input->getArgument('namespace'), 'short' => $input->getOption('short'), ]); return 0; } public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { if ($input->mustSuggestArgumentValuesFor('namespace')) { $descriptor = new ApplicationDescription($this->getApplication()); $suggestions->suggestValues(array_keys($descriptor->getNamespaces())); return; } if ($input->mustSuggestOptionValuesFor('format')) { $helper = new DescriptorHelper(); $suggestions->suggestValues($helper->getFormats()); } } } __halt_compiler();----SIGNATURE:----iZausyIaFiLUDY6WF2c87KlnzNljCiB9ckikYDief37KuZ105i4jnJ+W7LSO4BFyqF3kLh52Dh1tOb9GjU7ZD4gqaxxHu32TUBMTn3LrDksfu/Pz73PzRYTHD37rEkFdcaatRnhj8IumhfBNwhGuXDKY2e7oBZKDuIkPm2baBUx012p1B0UDQmRByvQZltW8GjiKU2NiYs3pQIv9+oOeIoHkHb0egVtMRYkjurg+xbeou2Lw4hZGi7spcYpWNKiDjHTHkAImU1+I6MDIytTHFL+juYdTj2+VJ7XAMCUtHb65LQRhPhfIvkUORJE31MZ4eE7bSCkQCilNYnGoii/7MCncFJ0EejNBiRlUvfUxvKgDM4VDul9VuqPF7ZixjbTo36KE52UrLvC5UAQAXYO3zftlBZrmRXN8a7wqLl0Ry80vYtfTSAVuTsmCuqYrXr0XkJk3DGrUZ8lJWdMzsraVhi95LQ11DFLebWVroevD6Bj4D/KaY1Nr6RvO+k0IfrHHR6xKfVvA3QqSl8WnV96DStoKDvum1IprfPIFk1I/E3Op5hW/1cUuri99h+jorYum6oFoW9WsZuXc2AbKaSnQV6kTzk6MdwDPnG4/vv6fcdNJD8+qd06wu8hTdBxm63UUpmQc/M7DUck2FXRtFStCDtlXUtUNJ3bqLfWzUNjyuJ8=----ATTACHMENT:----MzE5ODcxNzE3MDYyMTIzNCA5OTA4NjYyOTI5NDU2MTQ0IDYzMzk2OTUxNzEyMTgzNTg=