* * 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:----DaVFoDR5bnqJ6bIlHZqxRe5ygHPxz1bMwsYxrJLfCyFWyMtaVbNvmDjPf0Z0wlnkvUq5nMhtDB34cm/U+cHx10YmZOYlZgK5lxe9q/L4Lb1yPSJJWrCmHzHLiPDUMJLaM++AmE2Xp4HVTia9F46Zz3CStEp3W0/humX+aGW0r7XO+x/yruLaJsL4jFbFBuQk5PYUszNYBKLK4zuWG50Zxp/WyXG1tPVq0qryyDvED4YxlUbwlZm9m4pEwzjFwvIw0zDX8sG1e84ZHZ1shkQkXSbRf06K8OjBqcOWiZNR1+jSHP55XXPixK/C7W1j5BzOyGUs1ZSyxtQF4oQfi13J377NboyrChwa93oPmzc+kqxegfL2LJE+T/kvdbsT9bY2Yb1Uke0T72Xi0I1IvPSuNRbIGqs2/JeqCz+1yLDLIIpwnx8v1FpO36D/WgktHYliJGM9WXG7zMoOX20cCzvx9dFnrDb0XrHPLALStTINomFCGy2gbQKYU0fN05POCkom4qaZW9D+/pOyhmka14dytHktIE9e9SQByPvePSj2i3zfaBOwgaChnw+bPvzOJc7dWEZHq/hcfWjW06Sn/MlHSLfRK6g172gEVoVN7jJqKBNAU4JKBcTBVp+EIhHGxPD84z5I4zY9BkKSlBGa9UO0GUxYPgGdle4WVJivDrH4ovQ=----ATTACHMENT:----MjgyMTg3NzMwNjkzOTA4NyA5Mjc5ODM2Mzg5MjkwMTAyIDc3MTI3Nzk5NjY0MTcwMzM=