Пример #1
0
 /**
  * Render the provided error message and display the command's help content.
  *
  * @param string $errorMessage
  * @param boolean $displayHelp
  *
  * @return boolean
  */
 protected function abort($errorMessage, $displayHelp = true)
 {
     $this->renderer->error($errorMessage);
     if ($displayHelp) {
         $this->help();
     } else {
         $this->renderer->newline();
     }
     return false;
 }
Пример #2
0
 /**
  * Find the selected command, if any, and execute it.  If no command is
  * selected, display the default help content instead.  Either way,
  * execution is halted after this method is done.
  *
  * @return void
  */
 public function run()
 {
     $this->instantiateCommands();
     /* @var $command CommandAbstract */
     foreach ($this->commands as $name => $command) {
         if ($command->isSelected($this->command)) {
             $this->executeCommand($name);
             $this->halt();
             return;
         }
     }
     $this->renderer->error('Please specify a valid command as the first argument.');
     $this->executeCommand('Help');
     $this->halt();
 }