You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Cilex framework.
|
|
*
|
|
* (c) Mike van Riel <mike.vanriel@naenius.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Cilex\Command;
|
|
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
/**
|
|
* Example command for testing purposes.
|
|
*/
|
|
class GreetCommand extends Command
|
|
{
|
|
protected function configure()
|
|
{
|
|
$this
|
|
->setName('demo:greet')
|
|
->setDescription('Greet someone')
|
|
->addArgument('name', InputArgument::OPTIONAL, 'Who do you want to greet?')
|
|
->addOption('yell', null, InputOption::VALUE_NONE, 'If set, the task will yell in uppercase letters');
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$text = 'Hello';
|
|
$name = $input->getArgument('name');
|
|
if ($name) {
|
|
$text .= ' '.$name;
|
|
}
|
|
|
|
if ($input->getOption('yell')) {
|
|
$text = strtoupper($text);
|
|
}
|
|
|
|
$output->writeln($text);
|
|
}
|
|
}
|