Example #1
0
 /**
  * @param string $cmd
  * @param IOInterface $io
  */
 protected static function executeCommand($cmd, IOInterface $io)
 {
     if ($io->isDecorated()) {
         $cmd .= ' --ansi';
     }
     self::getContainer()->executeCommand($cmd, 0);
 }
Example #2
0
 /**
  * @param IOInterface $io
  * @param string      $question
  * @param bool        $default
  * @return bool
  */
 public function askConfirmation(IOInterface $io, $question, $default = true)
 {
     $question = $this->getDecoratedMessage($question, 'question', $io->isDecorated()) . ' ';
     $question .= '(Y/n): ';
     return $io->askConfirmation($question, $default);
 }
Example #3
0
 /**
  * Running the given command only when we are in dev-mode
  * The output will be send directly to the output buffer
  *
  * @param string      $command
  * @param IOInterface $io
  * @param boolean     $isDevMode
  *
  */
 public static function runCommandOnlyInDevMode($command, IOInterface $io, $isDevMode)
 {
     // make our command look nice
     if ($io->isDecorated()) {
         $formattedCommand = '<comment>' . $command . '</comment>';
     } else {
         $formattedCommand = $command;
     }
     // in production mode?
     if (!$isDevMode) {
         $io->write(sprintf('Skipping %1$s as we are in production mode', $formattedCommand));
     } else {
         $io->write(sprintf('Running %1$s', $formattedCommand));
         passthru($command);
     }
 }