@@ -35,7 +35,7 @@ Creating a basic Command
3535To make a console command that greets you from the command line, create ``GreetCommand.php ``
3636and add the following to it::
3737
38- namespace Acme\DemoBundle\ Command;
38+ namespace Acme\Command;
3939
4040 use Symfony\Component\Console\Command\Command;
4141 use Symfony\Component\Console\Input\InputArgument;
@@ -86,9 +86,9 @@ an ``Application`` and adds commands to it::
8686
8787 #!/usr/bin/env php
8888 <?php
89- // app/console
89+ // application.php
9090
91- use Acme\DemoBundle\ Command\GreetCommand;
91+ use Acme\Command\GreetCommand;
9292 use Symfony\Component\Console\Application;
9393
9494 $application = new Application();
@@ -99,7 +99,7 @@ Test the new console command by running the following
9999
100100.. code-block :: bash
101101
102- $ app/console demo:greet Fabien
102+ $ php application.php demo:greet Fabien
103103
104104 This will print the following to the command line:
105105
@@ -111,7 +111,7 @@ You can also use the ``--yell`` option to make everything uppercase:
111111
112112.. code-block :: bash
113113
114- $ app/console demo:greet Fabien --yell
114+ $ php application.php demo:greet Fabien --yell
115115
116116 This prints::
117117
@@ -232,8 +232,8 @@ The command can now be used in either of the following ways:
232232
233233.. code-block :: bash
234234
235- $ app/console demo:greet Fabien
236- $ app/console demo:greet Fabien Potencier
235+ $ php application.php demo:greet Fabien
236+ $ php application.php demo:greet Fabien Potencier
237237
238238 It is also possible to let an argument take a list of values (imagine you want
239239to greet all your friends). For this it must be specified at the end of the
@@ -251,7 +251,7 @@ To use this, just specify as many names as you want:
251251
252252.. code-block :: bash
253253
254- $ app/console demo:greet Fabien Ryan Bernhard
254+ $ php application.php demo:greet Fabien Ryan Bernhard
255255
256256 You can access the ``names `` argument as an array::
257257
@@ -321,8 +321,8 @@ flag:
321321
322322.. code-block :: bash
323323
324- $ app/console demo:greet Fabien
325- $ app/console demo:greet Fabien --iterations=5
324+ $ php application.php demo:greet Fabien
325+ $ php application.php demo:greet Fabien --iterations=5
326326
327327 The first example will only print once, since ``iterations `` is empty and
328328defaults to ``1 `` (the last argument of ``addOption ``). The second example
@@ -333,8 +333,8 @@ will work:
333333
334334.. code-block :: bash
335335
336- $ app/console demo:greet Fabien --iterations=5 --yell
337- $ app/console demo:greet Fabien --yell --iterations=5
336+ $ php application.php demo:greet Fabien --iterations=5 --yell
337+ $ php application.php demo:greet Fabien --yell --iterations=5
338338
339339 There are 4 option variants you can use:
340340
@@ -380,9 +380,9 @@ useful one is the :class:`Symfony\\Component\\Console\\Tester\\CommandTester`
380380class. It uses special input and output classes to ease testing without a real
381381console::
382382
383+ use Acme\Command\GreetCommand;
383384 use Symfony\Component\Console\Application;
384385 use Symfony\Component\Console\Tester\CommandTester;
385- use Acme\DemoBundle\Command\GreetCommand;
386386
387387 class ListCommandTest extends \PHPUnit_Framework_TestCase
388388 {
@@ -409,9 +409,9 @@ You can test sending arguments and options to the command by passing them
409409as an array to the :method: `Symfony\\ Component\\ Console\\ Tester\\ CommandTester::execute `
410410method::
411411
412+ use Acme\Command\GreetCommand;
412413 use Symfony\Component\Console\Application;
413414 use Symfony\Component\Console\Tester\CommandTester;
414- use Acme\DemoBundle\Command\GreetCommand;
415415
416416 class ListCommandTest extends \PHPUnit_Framework_TestCase
417417 {
@@ -491,6 +491,7 @@ Learn More!
491491
492492* :doc: `/components/console/usage `
493493* :doc: `/components/console/single_command_tool `
494+ * :doc: `/components/console/events `
494495
495496.. _Packagist : https://packagist.org/packages/symfony/console
496497.. _ANSICON : https://github.com/adoxa/ansicon/downloads
0 commit comments