/**
  * Initalized command
  *
  * @throws \RuntimeException
  */
 protected function initialize()
 {
     parent::initialize();
     $editorCmd = getenv('EDITOR');
     if (empty($editorCmd)) {
         throw new \RuntimeException('No $EDITOR environment variable set');
     }
     $this->parse($editorCmd);
 }
Beispiel #2
0
 /**
  * Initalized command
  */
 protected function initialize()
 {
     parent::initialize();
     $arguments = $_SERVER['argv'];
     // Check if command is run inside PHAR
     if (\Phar::running()) {
         // PHAR version
         $this->setCommand(array_shift($arguments));
     } elseif (!empty($_SERVER['_'])) {
         // Plain PHP version
         if ($_SERVER['argv'][0] !== $_SERVER['_']) {
             $this->setCommand($_SERVER['_']);
             $this->addArgument(reset($arguments));
         }
     }
     // Fallback
     if (!$this->getCommand()) {
         $this->setCommand('php');
         $this->addArgument($_SERVER['PHP_SELF']);
     }
 }
 /**
  * Initalized command
  */
 protected function initialize()
 {
     parent::initialize();
     $arguments = $_SERVER['argv'];
     if (\Phar::running()) {
         // running as phar
         $this->setCommand(array_shift($arguments));
     } elseif (!empty($_SERVER['_'])) {
         if ($_SERVER['argv'][0] !== $_SERVER['_']) {
             $this->setCommand($_SERVER['_']);
             $this->addArgument(array_shift($arguments));
         }
     }
     // Fallback
     if (!$this->getCommand()) {
         $this->setCommand('php');
         $this->addArgument($_SERVER['PHP_SELF']);
     }
     // All other arguments
     $this->addArgumentList($arguments);
 }