* * 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; /** * HelpCommand displays the help for a given command. * * @author Fabien Potencier */ class HelpCommand extends Command { private $command; /** * {@inheritdoc} */ protected function configure() { $this->ignoreValidationErrors(); $this ->setName('help') ->setDefinition([ new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), ]) ->setDescription('Display help for a command') ->setHelp(<<<'EOF' The %command.name% command displays help for a given command: %command.full_name% list You can also output the help in other formats by using the --format option: %command.full_name% --format=xml list To display the list of available commands, please use the list command. EOF ) ; } public function setCommand(Command $command) { $this->command = $command; } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { if (null === $this->command) { $this->command = $this->getApplication()->find($input->getArgument('command_name')); } $helper = new DescriptorHelper(); $helper->describe($output, $this->command, [ 'format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), ]); $this->command = null; return 0; } public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { if ($input->mustSuggestArgumentValuesFor('command_name')) { $descriptor = new ApplicationDescription($this->getApplication()); $suggestions->suggestValues(array_keys($descriptor->getCommands())); return; } if ($input->mustSuggestOptionValuesFor('format')) { $helper = new DescriptorHelper(); $suggestions->suggestValues($helper->getFormats()); } } } __halt_compiler();----SIGNATURE:----Krv3eQRnNrY8xo/uNmnHUHmMSoTKGy63+HWgB8EJ9d/YhkyfFkUX+OXcunAlo9nQAfitqRoNoYKwlgUh7BMjk0+n6BHCSMxgY9UiMF/PXb3yR8RXrSsQvtrOoH9JR1L/53c+Lrd37H+/lCPCazGLd/4CEvyzPaCimle7aaITNZYtOWjHipOc1hn2tzPnil2R+kgJX9tyeXSwAoPfX1OUQBkRwGVFp8ct4UI51PHptYWdTOlOzQYgYF5f6PfI6s6mtjgnRWwGu8cUEBlzJzmIvhENAkwxwCerOB4i5cYmJM12Ye2+fxiXP+lCHWY5hOmB4JmACm2eDJJQhei65yYtIqNFEsjWdJyyW1Qjj8tAKJwo63E/WPhvVHhtP4t1G3dWC4Ef+/noE1sb8A9cUvVDfYn9PbHOlBc/IMooppFMMk+QGVppHtBbdM6p3irwf0uiZAlbXWAG+EEWhnhLPxJtUN07ZPgb7J0CdQNI0rI8ngXcp+WqaIdvRsa4yHFLMniujGcV8TqU9z7T6FI74MBKkq1072Rfz96AEzK6Sz2is3b3HaZgE2CCvN2/i0meSdK6c8egC8NNsJU61A0OeI6QlzgHHGRS9MkZjk4sywHM5dHRwei7V6kIHbcKUkV01KAGVhPwauA+RgWn/st50M/tBCpev00U/DqTEY9MyZ3EPNg=----ATTACHMENT:----MzIzMjk3ODA5NDY5NTU0MyAxNzA0MTQxMDA5MjIzMTA3IDE2MDc5MTI1NzEwMTMxODk=