2 namespace Drupal\woot\Commands;
4 use Symfony\Component\Console\Command\Command;
5 use Symfony\Component\Console\Input\InputArgument;
6 use Symfony\Component\Console\Input\InputInterface;
7 use Symfony\Component\Console\Input\InputOption;
8 use Symfony\Component\Console\Output\OutputInterface;
11 * This is a literal copy of the example Symfony Console command
12 * from the documentation.
14 * See: http://symfony.com/doc/2.7/components/console/introduction.html#creating-a-basic-command
16 class GreetCommand extends Command
18 protected function configure()
21 ->setName('demo:greet')
22 ->setDescription('Greet someone')
25 InputArgument::OPTIONAL,
26 'Who do you want to greet?'
31 InputOption::VALUE_NONE,
32 'If set, the task will yell in uppercase letters'
37 protected function execute(InputInterface $input, OutputInterface $output)
39 $name = $input->getArgument('name');
41 $text = 'Hello '.$name;
46 if ($input->getOption('yell')) {
47 $text = strtoupper($text);
50 $output->writeln($text);