Symfony\Component\Console\Application::setDefaultCommand PHP Method

setDefaultCommand() public method

Sets the default Command name.
public setDefaultCommand ( string $commandName, boolean $isSingleCommand = false ) : self
$commandName string The Command name
$isSingleCommand boolean Set to true if there is only one command in this application
return self
    public function setDefaultCommand($commandName, $isSingleCommand = false)
    {
        $this->defaultCommand = $commandName;
        if ($isSingleCommand) {
            // Ensure the command exist
            $this->find($commandName);
            $this->singleCommand = true;
        }
        return $this;
    }

Usage Example

 /**
  * @return Application
  */
 public function create()
 {
     $app = new Application(Message::NAME, Message::VERSION);
     $app->setDefaultCommand(Message::COMMAND);
     $app->add($this->createAnalyzeCommand());
     return $app;
 }
All Usage Examples Of Symfony\Component\Console\Application::setDefaultCommand