diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-22 08:30:07 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-22 08:30:07 +0100 |
commit | 93fd4692f6eb753cae16358131c8049d84cfbb41 (patch) | |
tree | 1ef2f66eb378cf419d1aa033a2c772539e60537d /src/Acme/DemoBundle/Command | |
parent | 0440249631164a378981d014bf71b617c082bf5a (diff) | |
download | wallabag-93fd4692f6eb753cae16358131c8049d84cfbb41.tar.gz wallabag-93fd4692f6eb753cae16358131c8049d84cfbb41.tar.zst wallabag-93fd4692f6eb753cae16358131c8049d84cfbb41.zip |
symfony is there
Diffstat (limited to 'src/Acme/DemoBundle/Command')
-rw-r--r-- | src/Acme/DemoBundle/Command/HelloWorldCommand.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/Acme/DemoBundle/Command/HelloWorldCommand.php b/src/Acme/DemoBundle/Command/HelloWorldCommand.php new file mode 100644 index 00000000..998cbcdf --- /dev/null +++ b/src/Acme/DemoBundle/Command/HelloWorldCommand.php | |||
@@ -0,0 +1,48 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Command; | ||
4 | |||
5 | use Symfony\Component\Console\Command\Command; | ||
6 | use Symfony\Component\Console\Input\InputArgument; | ||
7 | use Symfony\Component\Console\Input\InputInterface; | ||
8 | use Symfony\Component\Console\Output\OutputInterface; | ||
9 | |||
10 | /** | ||
11 | * Hello World command for demo purposes. | ||
12 | * | ||
13 | * You could also extend from Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand | ||
14 | * to get access to the container via $this->getContainer(). | ||
15 | * | ||
16 | * @author Tobias Schultze <http://tobion.de> | ||
17 | */ | ||
18 | class HelloWorldCommand extends Command | ||
19 | { | ||
20 | /** | ||
21 | * {@inheritdoc} | ||
22 | */ | ||
23 | protected function configure() | ||
24 | { | ||
25 | $this | ||
26 | ->setName('acme:hello') | ||
27 | ->setDescription('Hello World example command') | ||
28 | ->addArgument('who', InputArgument::OPTIONAL, 'Who to greet.', 'World') | ||
29 | ->setHelp(<<<EOF | ||
30 | The <info>%command.name%</info> command greets somebody or everybody: | ||
31 | |||
32 | <info>php %command.full_name%</info> | ||
33 | |||
34 | The optional argument specifies who to greet: | ||
35 | |||
36 | <info>php %command.full_name%</info> Fabien | ||
37 | EOF | ||
38 | ); | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * {@inheritdoc} | ||
43 | */ | ||
44 | protected function execute(InputInterface $input, OutputInterface $output) | ||
45 | { | ||
46 | $output->writeln(sprintf('Hello <comment>%s</comment>!', $input->getArgument('who'))); | ||
47 | } | ||
48 | } | ||