Skip to content

Commit

Permalink
SetDefaultCommand first arg is command name
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelandrieu committed Aug 29, 2016
1 parent 64e9bbe commit 560426f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions components/console/single_command_tool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,17 @@ Of course, you can still register a command as usual::
require __DIR__.'/vendor/autoload.php';

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

use Acme\Command\DefaultCommand;

$application = new Application('echo', '1.0.0');
$command = new DefaultCommand();

$application->add($command);
$application->setDefaultCommand($command, true);

$application->setDefaultCommand($command->getName(), true);
$application->run();

.. tip::

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

0 comments on commit 560426f

Please sign in to comment.