Skip to content

Commit 560426f

Browse files
SetDefaultCommand first arg is command name
1 parent 64e9bbe commit 560426f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

components/console/single_command_tool.rst

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,17 @@ Of course, you can still register a command as usual::
4141
require __DIR__.'/vendor/autoload.php';
4242

4343
use Symfony\Component\Console\Application;
44-
use Symfony\Component\Console\Input\InputArgument;
45-
use Symfony\Component\Console\Input\InputInterface;
46-
use Symfony\Component\Console\Input\InputOption;
47-
use Symfony\Component\Console\Output\OutputInterface;
48-
44+
4945
use Acme\Command\DefaultCommand;
50-
46+
5147
$application = new Application('echo', '1.0.0');
5248
$command = new DefaultCommand();
53-
49+
5450
$application->add($command);
55-
56-
$application->setDefaultCommand($command, true);
51+
52+
$application->setDefaultCommand($command->getName(), true);
5753
$application->run();
58-
54+
5955
.. tip::
6056

6157
You don't need to pass the command name in order to get the help.

0 commit comments

Comments
 (0)