comparison vendor/symfony/console/Command/HelpCommand.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
11 11
12 namespace Symfony\Component\Console\Command; 12 namespace Symfony\Component\Console\Command;
13 13
14 use Symfony\Component\Console\Helper\DescriptorHelper; 14 use Symfony\Component\Console\Helper\DescriptorHelper;
15 use Symfony\Component\Console\Input\InputArgument; 15 use Symfony\Component\Console\Input\InputArgument;
16 use Symfony\Component\Console\Input\InputInterface;
16 use Symfony\Component\Console\Input\InputOption; 17 use Symfony\Component\Console\Input\InputOption;
17 use Symfony\Component\Console\Input\InputInterface;
18 use Symfony\Component\Console\Output\OutputInterface; 18 use Symfony\Component\Console\Output\OutputInterface;
19 19
20 /** 20 /**
21 * HelpCommand displays the help for a given command. 21 * HelpCommand displays the help for a given command.
22 * 22 *
33 { 33 {
34 $this->ignoreValidationErrors(); 34 $this->ignoreValidationErrors();
35 35
36 $this 36 $this
37 ->setName('help') 37 ->setName('help')
38 ->setDefinition(array( 38 ->setDefinition([
39 new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), 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'), 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'), 41 new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
42 )) 42 ])
43 ->setDescription('Displays help for a command') 43 ->setDescription('Displays help for a command')
44 ->setHelp(<<<'EOF' 44 ->setHelp(<<<'EOF'
45 The <info>%command.name%</info> command displays help for a given command: 45 The <info>%command.name%</info> command displays help for a given command:
46 46
47 <info>php %command.full_name% list</info> 47 <info>php %command.full_name% list</info>
69 if (null === $this->command) { 69 if (null === $this->command) {
70 $this->command = $this->getApplication()->find($input->getArgument('command_name')); 70 $this->command = $this->getApplication()->find($input->getArgument('command_name'));
71 } 71 }
72 72
73 $helper = new DescriptorHelper(); 73 $helper = new DescriptorHelper();
74 $helper->describe($output, $this->command, array( 74 $helper->describe($output, $this->command, [
75 'format' => $input->getOption('format'), 75 'format' => $input->getOption('format'),
76 'raw_text' => $input->getOption('raw'), 76 'raw_text' => $input->getOption('raw'),
77 )); 77 ]);
78 78
79 $this->command = null; 79 $this->command = null;
80 } 80 }
81 } 81 }