0487a024a1e611426c47d3660d0280fc6831402b
[yaffs-website] / vendor / consolidation / config / tests / src / MyFooCommand.php
1 <?php
2 namespace Consolidation\TestUtils;
3
4 use Symfony\Component\Console\Command\Command;
5 use Symfony\Component\Console\Input\InputInterface;
6 use Symfony\Component\Console\Output\OutputInterface;
7 use Symfony\Component\Console\Input\InputOption;
8
9 class MyFooCommand extends Command
10 {
11     protected function configure()
12     {
13         $this
14             ->setName('my:foo')
15             ->setDescription('My foo command.')
16             ->setHelp('This command tests command option injection by echoing its options')
17             ->addOption(
18                 'other',
19                 null,
20                 InputOption::VALUE_REQUIRED,
21                 'Some other option',
22                 'fish'
23             )
24             ->addOption(
25                 'name',
26                 null,
27                 InputOption::VALUE_REQUIRED,
28                 'What is the name of the thing we are naming',
29                 'George'
30             )
31             ->addOption(
32                 'dir',
33                 null,
34                 InputOption::VALUE_REQUIRED,
35                 'What is the base directory to use for this command',
36                 '/default/path'
37             );
38     }
39
40     protected function execute(InputInterface $input, OutputInterface $output)
41     {
42         $output->writeln('Enter my:foo');
43         $output->writeln('dir: ' . $input->getOption('dir'));
44         $output->writeln('name: ' . $input->getOption('name'));
45         $output->writeln('other: ' . $input->getOption('other'));
46     }
47 }