示例#1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->useIsoStandard = $input->getOption('sunday') == true ? false : true;
     $output->getFormatter()->setStyle('lvl0', new ColorOutputFormatterStyle('lvl0'));
     $output->getFormatter()->setStyle('lvl1', new ColorOutputFormatterStyle('lvl1'));
     $output->getFormatter()->setStyle('lvl2', new ColorOutputFormatterStyle('lvl2'));
     $output->getFormatter()->setStyle('lvl3', new ColorOutputFormatterStyle('lvl3'));
     $output->getFormatter()->setStyle('lvl4', new ColorOutputFormatterStyle('lvl4'));
     $matrix = $this->getMatrix();
     $counts = $this->getCommitCounts($matrix);
     $q1 = $counts[intval(count($counts) / 4)];
     $q2 = $counts[intval(count($counts) / 2)];
     $q3 = $counts[intval(count($counts) * 3 / 4)];
     $output->writeln("╔" . str_repeat("═", count($matrix) / 7 * 2 + 5) . "╗");
     $output->writeln("║ " . $this->getMonthsHeader($matrix) . " ║");
     for ($weekday = 1; $weekday <= 7; $weekday++) {
         $weekdayModulus = $weekday == 7 ? 0 : $weekday;
         $days = [];
         foreach ($matrix as $dayNumber => $day) {
             if ($dayNumber % 7 == $weekdayModulus) {
                 $days[] = $this->getBlock($day['commits'], $q1, $q2, $q3);
             }
         }
         $output->writeln("║ " . $this->getWeekdayName($weekday - 1) . " " . implode(' ', $days) . " ║");
     }
     $output->writeln("║" . str_repeat(" ", count($matrix) / 7 * 2 + 5) . "║");
     $output->writeln("║" . $this->getLegend(count($matrix) / 7 * 2 + 5) . "║");
     $output->writeln("╚" . str_repeat("═", count($matrix) / 7 * 2 + 5) . "╝");
 }
示例#2
0
 /**
  * Executes the application.
  *
  * Available options:
  *
  *  * interactive:               Sets the input interactive flag
  *  * decorated:                 Sets the output decorated flag
  *  * verbosity:                 Sets the output verbosity flag
  *  * capture_stderr_separately: Make output of stdOut and stdErr separately available
  *
  * @param array $input   An array of arguments and options
  * @param array $options An array of options
  *
  * @return int The command exit code
  */
 public function run(array $input, $options = array())
 {
     $this->input = new ArrayInput($input);
     if (isset($options['interactive'])) {
         $this->input->setInteractive($options['interactive']);
     }
     $this->captureStreamsIndependently = array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
     if (!$this->captureStreamsIndependently) {
         $this->output = new StreamOutput(fopen('php://memory', 'w', false));
         if (isset($options['decorated'])) {
             $this->output->setDecorated($options['decorated']);
         }
         if (isset($options['verbosity'])) {
             $this->output->setVerbosity($options['verbosity']);
         }
     } else {
         $this->output = new ConsoleOutput(isset($options['verbosity']) ? $options['verbosity'] : ConsoleOutput::VERBOSITY_NORMAL, isset($options['decorated']) ? $options['decorated'] : null);
         $errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
         $errorOutput->setFormatter($this->output->getFormatter());
         $errorOutput->setVerbosity($this->output->getVerbosity());
         $errorOutput->setDecorated($this->output->isDecorated());
         $reflectedOutput = new \ReflectionObject($this->output);
         $strErrProperty = $reflectedOutput->getProperty('stderr');
         $strErrProperty->setAccessible(true);
         $strErrProperty->setValue($this->output, $errorOutput);
         $reflectedParent = $reflectedOutput->getParentClass();
         $streamProperty = $reflectedParent->getProperty('stream');
         $streamProperty->setAccessible(true);
         $streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
     }
     return $this->statusCode = $this->application->run($this->input, $this->output);
 }
示例#3
0
 public function addStyles(OutputInterface $output)
 {
     $style = new OutputFormatterStyle('white', 'green', ['bold']);
     $output->getFormatter()->setStyle('notice', $style);
     $style = new OutputFormatterStyle(null, null, ['bold']);
     $output->getFormatter()->setStyle('bold', $style);
 }
 protected function outputFormatterEscape($message)
 {
     if ($this->output) {
         return $this->output->getFormatter()->escape($message);
     }
     return $message;
 }
示例#5
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->getFormatter()->setStyle('red', new OutputFormatterStyle('red'));
     $output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan'));
     $output->getFormatter()->setStyle('green', new OutputFormatterStyle('green'));
     $output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta'));
     $this->progress = new ProgressBar($output);
     $this->progress->setFormat('Archiving <cyan>%current%</cyan> files [<green>%bar%</green>] %elapsed:6s% %memory:6s%');
     $name = basename($this->source);
     $dir = dirname($this->source);
     $date = date('YmdHis', time());
     $filename = $name . '-' . $date . '.zip';
     $destination = $input->getArgument('destination') ? $input->getArgument('destination') : ROOT_DIR;
     $destination = rtrim($destination, DS) . DS . $filename;
     $output->writeln('');
     $output->writeln('Creating new Backup "' . $destination . '"');
     $this->progress->start();
     $zip = new \ZipArchive();
     $zip->open($destination, \ZipArchive::CREATE);
     $zip->addEmptyDir($name);
     $this->folderToZip($this->source, $zip, strlen($dir . DS), $this->progress);
     $zip->close();
     $this->progress->finish();
     $output->writeln('');
     $output->writeln('');
 }
示例#6
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->destination = $input->getArgument('destination');
     $this->input = $input;
     $this->output = $output;
     // Create a red output option
     $this->output->getFormatter()->setStyle('red', new OutputFormatterStyle('red'));
     $this->output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan'));
     $this->output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta'));
     // Symlink the Core Stuff
     if ($input->getOption('symlink')) {
         // Create Some core stuff if it doesn't exist
         $this->createDirectories();
         // Loop through the symlink mappings and create the symlinks
         $this->symlink();
         // Copy the Core STuff
     } else {
         // Create Some core stuff if it doesn't exist
         $this->createDirectories();
         // Loop through the symlink mappings and copy what otherwise would be symlinks
         $this->copy();
     }
     $this->pages();
     $this->initFiles();
     $this->perms();
 }
 /**
  * execute api command
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $aData = array();
     // set colors and formats
     $oErrStyle = new OutputFormatterStyle('red', null, array('bold'));
     $oOkStyle = new OutputFormatterStyle('green', null, array('bold'));
     $oLogoStyle = new OutputFormatterStyle('cyan', null);
     $output->getFormatter()->setStyle('err', $oErrStyle);
     $output->getFormatter()->setStyle('ok', $oOkStyle);
     $output->getFormatter()->setStyle('sw', $oLogoStyle);
     // print logo
     $this->_printLogo($output);
     // Get active remote apps
     $aRemoteApps = RemoteAppQuery::create()->findByActivated(true);
     /** @var RemoteApp $oRemoteApp */
     $iCnt = 0;
     foreach ($aRemoteApps as $oRemoteApp) {
         // get cron string
         $aData[] = array($oRemoteApp->getId(), $oRemoteApp->getName(), $oRemoteApp->getLastRun()->format("d.m.Y H:i:s"));
         $iCnt++;
     }
     // get tablehelper for cli
     $oTable = $this->getHelper('table');
     $oTable->setHeaders(array('ID', 'Title', 'Lastrun'))->setRows($aData);
     $oTable->render($output);
     // green text
     $output->writeln("\n<fg=white;options=bold>     " . $iCnt . " Job(s) found</fg=white;options=bold>\n");
 }
 private function initStyle(OutputInterface $output)
 {
     $style = new OutputFormatterStyle('black', 'black');
     $output->getFormatter()->setStyle('blackc', $style);
     $style = new OutputFormatterStyle('white', 'white');
     $output->getFormatter()->setStyle('whitec', $style);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (info()->installMode()) {
         die('Opis Colibri is not installed' . PHP_EOL);
     }
     $output->getFormatter()->setStyle('b-error', new OutputFormatterStyle('white', 'red', array('bold')));
     $output->getFormatter()->setStyle('warning', new OutputFormatterStyle('yellow'));
     $output->getFormatter()->setStyle('b-warning', new OutputFormatterStyle('yellow', null, array('bold')));
     $output->getFormatter()->setStyle('b-info', new OutputFormatterStyle('green', null, array('bold')));
     $modules = $input->getArgument('module');
     foreach ($modules as $moduleName) {
         $module = module($moduleName);
         if (!$module->exists()) {
             $output->writeln('<error>Module <b-error>' . $moduleName . '</b-error> doesn\'t exist.</error>');
             continue;
         }
         if (!$module->isInstalled()) {
             $output->writeln('<warning>Module <b-warning>' . $moduleName . '</b-warning> is already uninstaled.</warning>');
             continue;
         }
         if ($module->isHidden()) {
             $output->writeln('<error>Module <b-error>' . $moduleName . '</b-error> is hidden and can\'t be uninstalled.');
             continue;
         }
         if ($module->uninstall()) {
             $output->writeln('<info>Module <b-info>' . $moduleName . '</b-info> was uninstalled.</info>');
         } else {
             $output->writeln('<error>Module <b-error>' . $moduleName . '</b-error> could not be uninstalled.</error>');
         }
     }
 }
示例#10
0
 /**
  * Initializes printer.
  *
  * @param OutputInterface     $output
  * @param TranslatorInterface $translator
  */
 public function __construct(OutputInterface $output, TranslatorInterface $translator)
 {
     $this->output = $output;
     $this->translator = $translator;
     $output->getFormatter()->setStyle('snippet_keyword', new OutputFormatterStyle(null, null, array('bold')));
     $output->getFormatter()->setStyle('snippet_undefined', new OutputFormatterStyle('yellow'));
 }
示例#11
0
 /**
  * Constructor
  *
  * @param OutputInterface $output
  */
 public function __construct(OutputInterface $output)
 {
     $this->console = $output;
     $outputFormatter = $this->console->getFormatter();
     $outputFormatter->setStyle('detail', new OutputFormatterStyle('blue'));
     $outputFormatter->setStyle('metadata', new OutputFormatterStyle('cyan'));
 }
 /**
  * @see parent::initialize()
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $style = new OutputFormatterStyle('blue', null, array('bold'));
     $output->getFormatter()->setStyle('b', $style);
     $style = new OutputFormatterStyle(null, 'red', array('bold'));
     $output->getFormatter()->setStyle('error', $style);
 }
示例#13
0
 /**
  * Display rule description
  *
  * @param  RuleInterface   $rule
  * @param  OutputInterface $output
  * @return void
  */
 public function describeRule(RuleInterface $rule, OutputInterface $output)
 {
     $output->getFormatter()->setStyle('strong', new OutputFormatterStyle(null, null, ['bold', 'reverse']));
     $output->getFormatter()->setStyle('em', new OutputFormatterStyle('yellow', null, ['bold']));
     $output->getFormatter()->setStyle('code', new OutputFormatterStyle('green'));
     $output->writeln("<strong>{$rule->getName()}</strong>\n");
     $output->writeln("{$rule->getLongDescription()}\n");
 }
示例#14
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param HelperSet $helperSet
  */
 public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
 {
     $this->input = $input;
     $this->output = $output;
     $this->helperSet = $helperSet;
     $this->output->getFormatter()->setStyle('header', new OutputFormatterStyle('yellow', null, array('bold')));
     $this->output->getFormatter()->setStyle('question', new OutputFormatterStyle('yellow', null, array('bold')));
 }
示例#15
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     // Configure extra output formats
     $this->output->getFormatter()->setStyle('bold', new OutputFormatterStyle('blue'));
     $this->fire();
 }
 private function configureOutputStyles()
 {
     $formatter = $this->output->getFormatter();
     $styles = ['debug' => new OutputFormatterStyle('cyan'), 'info' => new OutputFormatterStyle('green'), 'notice' => new OutputFormatterStyle('blue'), 'warning' => new OutputFormatterStyle('black', 'yellow'), 'error' => new OutputFormatterStyle('white', 'red'), 'critical' => new OutputFormatterStyle('white', 'red', array('underscore')), 'alert' => new OutputFormatterStyle('red', 'yellow'), 'emergency' => new OutputFormatterStyle('red', 'yellow', array('bold', 'blink'))];
     foreach ($styles as $name => $style) {
         $formatter->setStyle($name, $style);
     }
 }
示例#17
0
 /**
  * Prints example story syntax into console.
  *
  * @param   Symfony\Component\Console\Output\OutputInterface    $output
  * @param   string                                              $language
  */
 public function printSyntax(OutputInterface $output, $language = 'en')
 {
     $output->getFormatter()->setStyle('comment', new OutputFormatterStyle('yellow'));
     $output->getFormatter()->setStyle('keyword', new OutputFormatterStyle('green', null, array('bold')));
     $story = $this->dumper->dump($language);
     $story = preg_replace('/^\\#.*/', '<comment>$0</comment>', $story);
     $output->writeln($story);
 }
示例#18
0
 /**
  *
  */
 protected function init()
 {
     $styles = ['error' => ['fg' => 'red'], 'error_bold' => ['fg' => 'red', 'options' => ['bold']], 'error_header' => ['fg' => 'yellow', 'options' => ['underscore']], 'feature_subject' => ['fg' => 'cyan'], 'help' => ['fg' => 'cyan'], 'help_detail' => ['fg' => 'cyan', 'options' => ['bold']], 'info' => ['fg' => 'white', 'options' => ['bold']], 'code' => ['fg' => 'magenta'], 'processing' => ['fg' => 'default'], 'bd' => ['options' => ['bold']], 'u' => ['options' => ['underscore']], 'warning' => ['fg' => 'yellow'], 'warning_bold' => ['fg' => 'yellow', 'options' => ['bold']], 'c' => ['fg' => 'cyan'], 'cb' => ['fg' => 'cyan', 'options' => ['bold']], 'r' => ['fg' => 'red'], 'rb' => ['fg' => 'red', 'options' => ['bold']], 'y' => ['fg' => 'yellow'], 'yb' => ['fg' => 'yellow', 'options' => ['bold']], 'b' => ['fg' => 'blue'], 'bb' => ['fg' => 'blue', 'options' => ['bold']], 'w' => ['fg' => 'white'], 'wb' => ['fg' => 'white', 'options' => ['bold']], 'm' => ['fg' => 'magenta'], 'mb' => ['fg' => 'magenta', 'options' => ['bold']], 'g' => ['fg' => 'green'], 'gb' => ['fg' => 'green', 'options' => ['bold']]];
     foreach ($styles as $name => $definition) {
         $definition = array_merge(['fg' => 'default', 'bg' => 'default', 'options' => []], $definition);
         $this->output->getFormatter()->setStyle($name, new OutputFormatterStyle($definition['fg'], $definition['bg'], $definition['options']));
     }
 }
示例#19
0
文件: Help.php 项目: knectar/behat-ci
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     //Formatting terminal output
     $header_style = new OutputFormatterStyle('white', 'green', array('bold'));
     $error_style = new OutputFormatterStyle('white', 'red', array('bold'));
     $output->getFormatter()->setStyle('header', $header_style);
     $output->getFormatter()->setStyle('err', $error_style);
     $output->writeln('<err>Bh must be run with a subcommand (e.g., "bh schedule"). Run bh --help for more details.</err>');
 }
示例#20
0
 private function configureStyling(OutputInterface $output)
 {
     $merge = new OutputFormatterStyle("yellow");
     $protect = new OutputFormatterStyle("green");
     $replace = new OutputFormatterStyle("red");
     $output->getFormatter()->setStyle("merge", $merge);
     $output->getFormatter()->setStyle("protect", $protect);
     $output->getFormatter()->setStyle("replace", $replace);
 }
示例#21
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Create a red output option
     $output->getFormatter()->setStyle('red', new OutputFormatterStyle('red'));
     $output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan'));
     $output->getFormatter()->setStyle('green', new OutputFormatterStyle('green'));
     $output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta'));
     $this->cleanPaths($input, $output);
 }
 /**
  * Initializes printer.
  *
  * @param OutputInterface      $output
  * @param PatternTransformer   $patternTransformer
  * @param DefinitionTranslator $translator
  */
 public function __construct(OutputInterface $output, PatternTransformer $patternTransformer, DefinitionTranslator $translator)
 {
     $this->output = $output;
     $this->patternTransformer = $patternTransformer;
     $this->translator = $translator;
     $output->getFormatter()->setStyle('def_regex', new OutputFormatterStyle('yellow'));
     $output->getFormatter()->setStyle('def_regex_capture', new OutputFormatterStyle('yellow', null, array('bold')));
     $output->getFormatter()->setStyle('def_dimmed', new OutputFormatterStyle('black', null, array('bold')));
 }
示例#23
0
 /**
  * Initialize command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $this->request = new Request();
     $this->request->setInsecure($this->input->getOption('insecure'));
     $style = new OutputFormatterStyle('white', 'blue', array('bold'));
     $this->output->getFormatter()->setStyle('header', $style);
     $this->setUrl($input->getArgument('url'));
 }
 private function printWelcome(OutputInterface $output)
 {
     $output->getFormatter()->setStyle('heading', new OutputFormatterStyle('green', null, array('bold')));
     $output->getFormatter()->setStyle('bold', new OutputFormatterStyle(null, null, array('bold')));
     $output->writeln('<heading>Flickr Downloadr Authorization</heading>');
     $output->writeln('<info>This script runs the OAuth flow in out-of-band mode. You will need access to</info>');
     $output->writeln('<info>a web browser to authorise the application.</info>');
     $output->writeln('');
     $output->writeln('<info>At the end of this script credentials will be saved into config file.</info>');
     $output->writeln('');
 }
 protected function setOutputFormats(OutputInterface $output)
 {
     $output->getFormatter()->setStyle('disabled', new OutputFormatterStyle('yellow'));
     $output->getFormatter()->setStyle('enabled', new OutputFormatterStyle(null));
     $output->getFormatter()->setStyle('alpha', new OutputFormatterStyle('magenta'));
     $output->getFormatter()->setStyle('beta', new OutputFormatterStyle('yellow'));
     $output->getFormatter()->setStyle('rc', new OutputFormatterStyle('blue'));
     $output->getFormatter()->setStyle('stable', new OutputFormatterStyle('green'));
     $output->getFormatter()->setStyle('noupdate', new OutputFormatterStyle('cyan'));
     $output->getFormatter()->setStyle('admin', new OutputFormatterStyle('blue'));
     $output->getFormatter()->setStyle('disabled', new OutputFormatterStyle('yellow'));
     $output->getFormatter()->setStyle('locked', new OutputFormatterStyle('magenta'));
 }
示例#26
0
 /**
  * Executes controller.
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return null|integer
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$input->getOption('story-syntax')) {
         return null;
     }
     $output->getFormatter()->setStyle('gherkin_keyword', new OutputFormatterStyle('green', null, array('bold')));
     $output->getFormatter()->setStyle('gherkin_comment', new OutputFormatterStyle('yellow'));
     $story = $this->keywordsDumper->dump($this->translator->getLocale());
     $story = preg_replace('/^\\#.*/', '<gherkin_comment>$0</gherkin_comment>', $story);
     $output->writeln($story);
     $output->writeln('');
     return 0;
 }
示例#27
0
 /**
  * Initialize command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $url = new Url();
     try {
         $this->request = new Request($url->clean($input->getArgument('url')), $this->input->getOption('insecure'));
     } catch (\InvalidArgumentException $e) {
         // do nothing
     }
     $style = new OutputFormatterStyle('white', 'blue', ['bold']);
     $this->output->getFormatter()->setStyle('header', $style);
 }
示例#28
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $this->dialog = $this->getHelperSet()->get('dialog');
     $style = new OutputFormatterStyle('white', 'blue', array('bold'));
     $output->getFormatter()->setStyle('step', $style);
     $style = new OutputFormatterStyle('red', 'black', array('bold'));
     $output->getFormatter()->setStyle('logo', $style);
     $this->writeln(sprintf("<logo>%s%s</logo>\n", self::$logo, $this->center($this->getDescription())));
     $this->doExecute();
     $this->writeln('Execution finished');
 }
示例#29
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->output = $output;
     $output->getFormatter()->setStyle('red', new OutputFormatterStyle('red'));
     $output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan'));
     $output->getFormatter()->setStyle('green', new OutputFormatterStyle('green'));
     $output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta'));
     $this->progress = new ProgressBar($output);
     $this->progress->setFormat('Archiving <cyan>%current%</cyan> files [<green>%bar%</green>] %elapsed:6s% %memory:6s%');
     $destination = $input->getArgument('destination') ? $input->getArgument('destination') : ROOT_DIR;
     ZipBackup::backup($destination, [$this, 'output']);
     $output->writeln('');
     $output->writeln('');
 }
 public function setOutput(OutputInterface $output)
 {
     $this->output = $output;
     $this->output->getFormatter()->setStyle('dspec-fail', new OutputFormatterStyle('red'));
     $this->output->getFormatter()->setStyle('dspec-bold-fail', new OutputFormatterStyle('red', null, array('bold')));
     $this->output->getFormatter()->setStyle('dspec-pending', new OutputFormatterStyle('blue'));
     $this->output->getFormatter()->setStyle('dspec-bold-pending', new OutputFormatterStyle('blue'));
     $this->output->getFormatter()->setStyle('dspec-skipped', new OutputFormatterStyle('yellow'));
     $this->output->getFormatter()->setStyle('dspec-bold-skipped', new OutputFormatterStyle('yellow'));
     $this->output->getFormatter()->setStyle('dspec-pass', new OutputFormatterStyle('green'));
     $this->output->getFormatter()->setStyle('dspec-bold-pass', new OutputFormatterStyle('green', null, array('bold')));
     $this->output->getFormatter()->setStyle('dspec-meta', new OutputFormatterStyle('white', null, array()));
     return $this;
 }