forked from wallabag/wallabag
symfony is there
This commit is contained in:
48
src/Acme/DemoBundle/Command/HelloWorldCommand.php
Normal file
48
src/Acme/DemoBundle/Command/HelloWorldCommand.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Hello World command for demo purposes.
|
||||
*
|
||||
* You could also extend from Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand
|
||||
* to get access to the container via $this->getContainer().
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class HelloWorldCommand extends Command
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('acme:hello')
|
||||
->setDescription('Hello World example command')
|
||||
->addArgument('who', InputArgument::OPTIONAL, 'Who to greet.', 'World')
|
||||
->setHelp(<<<EOF
|
||||
The <info>%command.name%</info> command greets somebody or everybody:
|
||||
|
||||
<info>php %command.full_name%</info>
|
||||
|
||||
The optional argument specifies who to greet:
|
||||
|
||||
<info>php %command.full_name%</info> Fabien
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$output->writeln(sprintf('Hello <comment>%s</comment>!', $input->getArgument('who')));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user