@@ -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
@@ -267,8 +267,8 @@ The command can now be used in either of the following ways:
267267
268268.. code-block :: bash
269269
270- $ app/console demo:greet Fabien
271- $ app/console demo:greet Fabien Potencier
270+ $ php application.php demo:greet Fabien
271+ $ php application.php demo:greet Fabien Potencier
272272
273273 It is also possible to let an argument take a list of values (imagine you want
274274to greet all your friends). For this it must be specified at the end of the
@@ -286,7 +286,7 @@ To use this, just specify as many names as you want:
286286
287287.. code-block :: bash
288288
289- $ app/console demo:greet Fabien Ryan Bernhard
289+ $ php application.php demo:greet Fabien Ryan Bernhard
290290
291291 You can access the ``names `` argument as an array::
292292
@@ -356,8 +356,8 @@ flag:
356356
357357.. code-block :: bash
358358
359- $ app/console demo:greet Fabien
360- $ app/console demo:greet Fabien --iterations=5
359+ $ php application.php demo:greet Fabien
360+ $ php application.php demo:greet Fabien --iterations=5
361361
362362 The first example will only print once, since ``iterations `` is empty and
363363defaults to ``1 `` (the last argument of ``addOption ``). The second example
@@ -368,8 +368,8 @@ will work:
368368
369369.. code-block :: bash
370370
371- $ app/console demo:greet Fabien --iterations=5 --yell
372- $ app/console demo:greet Fabien --yell --iterations=5
371+ $ php application.php demo:greet Fabien --iterations=5 --yell
372+ $ php application.php demo:greet Fabien --yell --iterations=5
373373
374374 There are 4 option variants you can use:
375375
@@ -415,9 +415,9 @@ useful one is the :class:`Symfony\\Component\\Console\\Tester\\CommandTester`
415415class. It uses special input and output classes to ease testing without a real
416416console::
417417
418+ use Acme\Command\GreetCommand;
418419 use Symfony\Component\Console\Application;
419420 use Symfony\Component\Console\Tester\CommandTester;
420- use Acme\DemoBundle\Command\GreetCommand;
421421
422422 class ListCommandTest extends \PHPUnit_Framework_TestCase
423423 {
@@ -444,9 +444,9 @@ You can test sending arguments and options to the command by passing them
444444as an array to the :method: `Symfony\\ Component\\ Console\\ Tester\\ CommandTester::execute `
445445method::
446446
447+ use Acme\Command\GreetCommand;
447448 use Symfony\Component\Console\Application;
448449 use Symfony\Component\Console\Tester\CommandTester;
449- use Acme\DemoBundle\Command\GreetCommand;
450450
451451 class ListCommandTest extends \PHPUnit_Framework_TestCase
452452 {
@@ -526,6 +526,7 @@ Learn More!
526526
527527* :doc: `/components/console/usage `
528528* :doc: `/components/console/single_command_tool `
529+ * :doc: `/components/console/events `
529530
530531.. _Packagist : https://packagist.org/packages/symfony/console
531532.. _ANSICON : https://github.com/adoxa/ansicon/downloads
0 commit comments