function it_executes(InputInterface $input, OutputInterface $output, UserCommandBus $commandBus) { $input->getArgument('email')->shouldBeCalled()->willReturn('*****@*****.**'); $input->getArgument('password')->shouldBeCalled()->willReturn(123456); $input->hasArgument('command')->shouldBeCalled()->willReturn(true); $input->getArgument('command')->shouldBeCalled()->willReturn('command'); $input->bind(Argument::any())->shouldBeCalled(); $input->isInteractive()->shouldBeCalled()->willReturn(true); $input->validate()->shouldBeCalled(); $commandBus->handle(Argument::type(WithoutOldPasswordChangeUserPasswordCommand::class))->shouldBeCalled()->willReturn(['email' => '*****@*****.**', 'password' => 123456]); $output->writeln(sprintf('Changed password of <comment>%s</comment> %s', '*****@*****.**', 'user'))->shouldBeCalled(); $this->run($input, $output); }
protected static function checkArgumentCount(GeneratorInterface $generator, InputInterface $input) { $vars = $generator->getInputs(); $positionals = array_filter($vars, function (InputTypeInterface $var) { return !$var->isOptional(); }); $found = false; if (count($positionals) === 0) { return false; } /** @var InputTypeInterface $var */ foreach ($positionals as $var) { $name = $var->getArgumentName(); if ($var->isMultiple() && !$var->isRequired() && !$input->hasArgument($name)) { $input->setArgument($name, array()); } if (!$input->hasArgument($name) || $input->getArgument($name) === null) { if ($found) { throw new \RuntimeException("Not enough arguments"); } else { break; } } $found = true; } return $found; }
protected function execute(InputInterface $input, OutputInterface $output) { // Parse the arguments. $this->venue = $input->getArgument('venue'); if ($input->hasArgument('stock')) { $this->stock = $input->getArgument('stock'); } if ($input->hasArgument('account')) { $this->account = $input->getArgument('account'); } // Make sure the venue is up. $output->write('Making sure the venue is up... '); if ($this->venue()->heartbeat()) { $output->writeln('Yep!'); } else { $output->writeln('Nope :('); throw new StockfighterSolutionException('The venue ' . $this->venue . ' is down or does not exist.'); } // Run the inner execution. $result = $this->conduct($input, $output); if ($result !== null) { return $result; } // Run the loop. $this->stockfighter->run(); return 0; // For success. }
/** * @{inheritdoc} */ protected function initialize(InputInterface $input, OutputInterface $output) { if ($input->hasArgument('service_name')) { $this->servicesName = array_map('trim', explode(',', $input->getArgument('service_name'))); } if ($input->hasArgument('command_name')) { $this->serviceCommandName = $input->getArgument('command_name'); } }
/** * {@inheritdoc} */ protected function execute(Input $input, Output $output) { $stage = $input->hasArgument('stage') ? $input->getArgument('stage') : null; $tasks = $this->deployer->getScriptManager()->getTasks($this->getName(), $stage); $servers = $this->deployer->getStageStrategy()->getServers($stage); $environments = iterator_to_array($this->deployer->environments); if (isset($this->executor)) { $executor = $this->executor; } else { if ($input->getOption('parallel')) { $executor = new ParallelExecutor($this->deployer->getConsole()->getUserDefinition()); } else { $executor = new SeriesExecutor(); } } try { $executor->run($tasks, $servers, $environments, $input, $output); } catch (\Exception $exception) { \Deployer\logger($exception->getMessage(), Logger::ERROR); // Check if we have tasks to execute on failure. if ($this->deployer['onFailure']->has($this->getName())) { $taskName = $this->deployer['onFailure']->get($this->getName()); $tasks = $this->deployer->getScriptManager()->getTasks($taskName, $stage); $executor->run($tasks, $servers, $environments, $input, $output); } throw $exception; } if (Deployer::hasDefault('terminate_message')) { $output->writeln(Deployer::getDefault('terminate_message')); } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $message = $this->getMessageHelper(); $file = null; if ($input->hasArgument('file')) { $file = $input->getArgument('file'); } if (!file_exists($file)) { $message->addErrorMessage(sprintf($this->trans('commands.migrate.load.messages.invalid_file'), $file)); return 1; } if ($this->migration_id_found === false) { $migration_entity = $this->generateEntity($this->file_data, 'migration'); if ($migration_entity->isInstallable()) { $migration_entity->trustData()->save(); $output->writeln('[+] <info>' . sprintf($this->trans('commands.migrate.load.messages.installed') . '</info>')); } } $override = $input->getOption('override'); if ($override === 'yes') { $migration_updated = $this->updateEntity($this->file_data['id'], 'migration', $this->file_data); $migration_updated->trustData()->save(); $output->writeln('[+] <info>' . sprintf($this->trans('commands.migrate.load.messages.overridden') . '</info>')); } }
protected function interact(InputInterface $input, OutputInterface $output) { $questionHelper = $this->getQuestionHelper(); $questionHelper->writeSection($output, 'Welcome to the Doctrine2 CRUD generator'); // namespace $output->writeln(array('', 'This command helps you generate CRUD controllers and templates.', '', 'First, you need to give the entity for which you want to generate a CRUD.', 'You can give an entity that does not exist yet and the wizard will help', 'you defining it.', '', 'You must use the shortcut notation like <comment>AcmeBlogBundle:Post</comment>.', '')); if ($input->hasArgument('entity') && $input->getArgument('entity') != '') { $input->setOption('entity', $input->getArgument('entity')); } $question = new Question($questionHelper->getQuestion('The Entity shortcut name', $input->getOption('entity')), $input->getOption('entity')); $question->setValidator(array('Sensio\\Bundle\\GeneratorBundle\\Command\\Validators', 'validateEntityName')); $autocompleter = new EntitiesAutoCompleter($this->getContainer()->get('doctrine')->getManager()); $autocompleteEntities = $autocompleter->getSuggestions(); $question->setAutocompleterValues($autocompleteEntities); $entity = $questionHelper->ask($input, $output, $question); $input->setOption('entity', $entity); list($bundle, $entity) = $this->parseShortcutNotation($entity); // write? $withWrite = 'yes'; $input->setOption('with-write', $withWrite); // format $format = 'annotation'; $input->setOption('format', $format); // route prefix $prefix = $this->getRoutePrefix($input, $entity); $output->writeln(array('', 'Determine the routes prefix (all the routes will be "mounted" under this', 'prefix: /prefix/, /prefix/new, ...).', '')); $prefix = $questionHelper->ask($input, $output, new Question($questionHelper->getQuestion('Routes prefix', '/' . $prefix), '/' . $prefix)); $input->setOption('route-prefix', $prefix); // summary $output->writeln(array('', $this->getHelper('formatter')->formatBlock('Summary before generation', 'bg=blue;fg=white', true), '', sprintf("You are going to generate a CRUD controller for \"<info>%s:%s</info>\"", $bundle, $entity), sprintf("using the \"<info>%s</info>\" format.", $format), '')); }
protected function execute(InputInterface $input, OutputInterface $output) { try { $settings = new PhpParallelLint\Settings(); //$output->writeln("Hola"); if ($input->hasArgument("directory")) { $settings->paths = $input->getArgument("directory"); } if ($input->hasOption("exclude")) { $settings->excluded = $input->getOption("exclude"); } if ($input->hasOption("extension")) { $settings->extensions = $input->getOption("extension"); } if ($input->hasOption("number-jobs")) { $settings->parallelJobs = $input->getOption("number-jobs"); } if ($input->hasOption("no-colors")) { $settings->colors = false; } $manager = new PhpParallelLint\Manager(); $result = $manager->run($settings); } catch (Exception $e) { } }
/** * {@inheritdoc} */ protected function interact(InputInterface $input, OutputInterface $output) { /** @var StorageInterface $storage */ $storage = $this->getContainer()->get('storage'); $files = $input->getArgument('files'); if ($input->getOption('latest')) { $remoteFiles = $storage->remoteListing(); if (count($remoteFiles) > 0) { $files[] = end($remoteFiles); $input->setArgument('files', $files); } } if ($input->hasArgument('files') && !empty($files)) { return; } $remoteFiles = $storage->remoteListing(); $localFiles = $storage->localListing(); if (count(array_diff($remoteFiles, $localFiles)) === 0) { $output->writeln('All files fetched'); return; } $helper = $this->getHelper('question'); $question = new ChoiceQuestion('Which backup', array_values(array_diff($remoteFiles, $localFiles))); $question->setMultiselect(true); $question->setErrorMessage('Backup %s is invalid.'); $question->setAutocompleterValues([]); $input->setArgument('files', $helper->ask($input, $output, $question)); }
protected function execute(InputInterface $input) { $input->getArgument("<getArgument>"); $input->hasArgument("<hasArgument>"); $input->getOption("<getOption>"); $input->hasOption("<hasOption>"); }
protected function interact(InputInterface $input, OutputInterface $output) { $questionHelper = $this->getQuestionHelper(); $questionHelper->writeSection($output, 'Welcome to the Parse.com CRUD generator'); // namespace $output->writeln(array('', 'This command helps you generate CRUD controllers and templates.', 'You must use the shortcut notation like <comment>AcmeBlogBundle:Post</comment>.', '')); if ($input->hasArgument('parse-entity-name') && $input->getArgument('parse-entity-name') != '') { $input->setOption('parse-entity-name', $input->getArgument('parse-entity-name')); } $question = new Question($questionHelper->getQuestion('The Entity shortcut name', $input->getOption('parse-entity-name')), $input->getOption('parse-entity-name')); $question->setValidator(array('BcTic\\ParseCrudGenerator\\CrudGeneratorBundle\\Command\\Validators', 'validateParseEntityName')); $autocompleter = new EntitiesAutoCompleter($this->getContainer()->get('doctrine')->getManager()); $autocompleteEntities = $autocompleter->getSuggestions(); $question->setAutocompleterValues($autocompleteEntities); $entity = $questionHelper->ask($input, $output, $question); $input->setOption('parse-entity-name', $entity); list($bundle, $entity) = $this->parseShortcutNotation($entity); // route prefix $prefix = $this->getRoutePrefix($input, $entity); $output->writeln(array('', 'Determine the routes prefix (all the routes will be "mounted" under this', 'prefix: /prefix/, /prefix/new, ...).', '')); $prefix = $questionHelper->ask($input, $output, new Question($questionHelper->getQuestion('Routes prefix', '/' . $prefix), '/' . $prefix)); $input->setOption('route-prefix', $prefix); // summary $output->writeln(array('', $this->getHelper('formatter')->formatBlock('Summary before generation', 'bg=blue;fg=white', true), '', sprintf("You are going to generate a CRUD controller for \"<info>%s:%s</info>\"", $bundle, $entity), '')); }
/** * Guess best TYPO3 base path * * @param string $basePath System base path * @param InputInterface $input Input instance * @param null|string $inputArgName Input option name for base path * * @return null|string * @throws \RuntimeException */ public static function guessBestTypo3BasePath($basePath, $input = null, $inputArgName = null) { $ret = null; $userPath = null; if ($input !== null && $input instanceof InputInterface && $inputArgName !== null) { if ($input->hasArgument($inputArgName)) { $userPath = $input->getArgument($inputArgName); } } if (empty($userPath)) { // No user path specified, only use base path $ret = $basePath; } else { // check if path is an absolute path if (strpos($userPath, '/') === 0) { $ret = $userPath; } else { // relative path? try to guess the best match $guessPath = $basePath . '/' . $userPath; if (is_dir($guessPath)) { $ret = $guessPath; } } } if ($ret === null) { throw new \RuntimeException('Could not guess TYPO3 base path'); } return $ret; }
protected function execute(InputInterface $input, OutputInterface $output) { $toReindex = []; if ($input->hasArgument('entityName')) { $filter = $this->getEntityManager()->getRepository($input->getArgument('entityName'))->getClassName(); } else { $filter = null; } foreach ($this->getEntityClasses() as $class) { if (!$filter || $class === $filter) { $toReindex[] = $class; } } $nIndexed = 0; foreach ($toReindex as $className) { $nIndexed += $this->clear($className); } switch ($nIndexed) { case 0: $output->writeln('No entity cleared'); break; case 1: $output->writeln('<info>1</info> entity cleared'); break; default: $output->writeln(sprintf('<info>%s</info> entities cleared', $nIndexed)); break; } }
/** * Execute command. * * @param InputInterface $input * @param OutputInterface $output * * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { /** @var Application $app */ $app = $this->getApplication(); $this->updateManager = $app->getSlicer()->getUpdateManager(); if (NULL === $this->updateManager->getChangeProvider() && !$input->hasArgument('provider')) { throw new InvalidArgumentException('Change Provider must be specified either in slicer.json or as an argument'); } if ($input->hasArgument('provider')) { $provider = $input->getArgument('provider'); die($provider); } $start = $input->getArgument('starting-version'); $end = $input->getArgument('ending-version'); $result = $this->updateManager->createUpdate($start, $end); }
/** * @param InputInterface $input * @param OutputInterface $output * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { $log = new Logger('dns-updater'); $log->pushHandler(new StreamHandler(__DIR__ . '/application.log', Logger::INFO)); if ($input->hasArgument('name') && !empty($input->getArgument('name'))) { $names = [$input->getArgument('name')]; } else { $names = $this->getConfig('dns_records'); } $externalIp = $this->getExternalIp(); $output->writeln("<info>External IP queried: " . $externalIp . '</info>'); if ($this->hasIpChanged($externalIp)) { $this->storeIp($externalIp); $output->writeln(sprintf('<info>External ip %s has been changed, starting dns update</info>', $externalIp)); $log->addInfo(sprintf('External ip %s has been changed, starting dns update', $externalIp)); foreach ($names as $name) { if (!empty($name)) { $response = $this->removeDnsRecord($name); if ($response) { $output->writeln('<info>Removed dns record: ' . $name . '</info>'); $this->addDnsRecord($name, $externalIp); if ($response) { $output->writeln('<info>Added dns record: ' . $name . ' with ip ' . $externalIp . '</info>'); } else { $output->writeln('<error>Error while removing dns record: ' . $name . '</error>'); } } else { $output->writeln('<error>Error while removing dns record: ' . $name . '</error>'); } } } } else { $output->writeln(sprintf("<info>External ip %s matches stored ip address %s, skipping dns update</info>", $externalIp, $this->getStoredIp())); } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $identifier = $input->getArgument('identifier'); $product = $this->getProduct($identifier); if (null === $product) { $output->writeln(sprintf('<error>Product with identifier "%s" not found</error>', $identifier)); return -1; } if ($input->hasArgument('username') && '' != ($username = $input->getArgument('username'))) { if (!$this->createToken($output, $username)) { return -1; } } $updates = json_decode($input->getArgument('json_updates'), true); $this->update($product, $updates); $violations = $this->validate($product); foreach ($violations as $violation) { $output->writeln(sprintf("<error>%s</error>", $violation->getMessage())); } if (0 !== $violations->count()) { $output->writeln(sprintf('<error>Product "%s" is not valid</error>', $identifier)); return -1; } $this->save($product); $output->writeln(sprintf('<info>Product "%s" has been updated</info>', $identifier)); return 0; }
protected function initialize(InputInterface $input, OutputInterface $stdout) { $this->am = $this->getContainer()->get('assetic.asset_manager'); $this->basePath = $this->getContainer()->getParameter('assetic.write_to'); if ($input->hasArgument('write_to') && ($basePath = $input->getArgument('write_to'))) { $this->basePath = $basePath; } }
protected function execute(InputInterface $input, OutputInterface $output) { if ($input->hasArgument("directory")) { $lint = new Lint($input->getArgument("directory")); $lint->lint(); $output->writeln("Hola"); } }
/** * {@inheritdoc} */ protected function initialize(InputInterface $input, OutputInterface $output) { $kernel = $this->getApplication()->getKernel(); $this->input = $input; $this->output = $output; $this->cacheDir = $kernel->getCacheDir() . '/propel'; if ($input->hasArgument('bundle') && '@' === substr($input->getArgument('bundle'), 0, 1)) { $this->bundle = $this->getContainer()->get('kernel')->getBundle(substr($input->getArgument('bundle'), 1)); } }
protected function execute(InputInterface $input, OutputInterface $output) { $operator = $this->getOperator(); if ($input->hasArgument('value2')) { $result = $operator($input->getArgument('value1'), $input->getArgument('value2')); } else { $result = $operator($input->getArgument('value1')); } $output->write($result); }
protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->hasArgument('key') ? $input->getArgument('key') : ''; $value = $this->neptune['config']->getRequired($key); if ($input->getOption('php')) { $output->write(var_export($value) . PHP_EOL); return; } $output->write(Yaml::dump($value, 100, 2)); }
protected function execute(InputInterface $input, OutputInterface $output) { $method = $input->getOption('sync'); if (!in_array($method, array(Manager::SYNC_FULL, Manager::SYNC_DELTA))) { throw new CommandException(sprintf("You can only run a sync of one of the following types: %s, %s", Manager::SYNC_FULL, Manager::SYNC_DELTA)); } if ($method != Manager::SYNC_FULL && $input->getOption('reset')) { // $this->manager->resetIndex( $input->getArgument('index') ); } $this->manager->sync($method, $input->getArgument('index'), $input->hasArgument('type') ? $input->getArgument('type') : ''); $output->writeln('Sync Completed!'); }
/** * Execute command * * @param InputInterface $input Input instance * @param OutputInterface $output Output instance * * @return int|null|void */ public function execute(InputInterface $input, OutputInterface $output) { // Read grep value $grep = null; if ($input->hasArgument('grep')) { $grep = $input->getArgument('grep'); } $output->writeln('<h2>Starting apache log tail</h2>'); // Show log $logList = array('/var/log/apache2/access.log', '/var/log/apache2/error.log'); return $this->showLog($logList, $input, $output, $grep); }
protected function execute(InputInterface $input, OutputInterface $output) { $patchDir = $this->getContainer()->getParameter('db_patcher.patch_dir'); if ($input->hasArgument('filename') && !is_null($input->getArgument('filename'))) { $patchFileName = $input->getArgument('filename'); } else { $patchFileName = time() . '.sql'; } $fs = new Filesystem(); $fs->touch($patchDir . DIRECTORY_SEPARATOR . $patchFileName); $output->writeln(sprintf('Created patch file <comment>%s</comment> in %s.', $patchFileName, $patchDir)); }
protected function interact(InputInterface $input, OutputInterface $output) { $questionHelper = $this->getQuestionHelper(); $questionHelper->writeSection($output, 'Welcome to the Doctrine2 CRUD generator'); // namespace $output->writeln(array('', 'This command helps you generate CRUD controllers and templates.', '', 'First, give the name of the existing entity for which you want to generate a CRUD', '(use the shortcut notation like <comment>AcmeBlogBundle:Post</comment>)', '')); if ($input->hasArgument('entity') && $input->getArgument('entity') != '') { $input->setOption('entity', $input->getArgument('entity')); } $question = new Question($questionHelper->getQuestion('The Entity shortcut name', $input->getOption('entity')), $input->getOption('entity')); $question->setValidator(array('Sensio\\Bundle\\GeneratorBundle\\Command\\Validators', 'validateEntityName')); $autocompleter = new EntitiesAutoCompleter($this->getContainer()->get('doctrine')->getManager()); $autocompleteEntities = $autocompleter->getSuggestions(); $question->setAutocompleterValues($autocompleteEntities); $entity = $questionHelper->ask($input, $output, $question); $input->setOption('entity', $entity); list($bundle, $entity) = $this->parseShortcutNotation($entity); try { $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle) . '\\' . $entity; $metadata = $this->getEntityMetadata($entityClass); } catch (\Exception $e) { throw new \RuntimeException(sprintf('Entity "%s" does not exist in the "%s" bundle. You may have mistyped the bundle name or maybe the entity doesn\'t exist yet (create it first with the "doctrine:generate:entity" command).', $entity, $bundle)); } // write? $withWrite = $input->getOption('with-write') ?: false; $output->writeln(array('', 'By default, the generator creates two actions: list and show.', 'You can also ask it to generate "write" actions: new, update, and delete.', '')); $question = new ConfirmationQuestion($questionHelper->getQuestion('Do you want to generate the "write" actions', $withWrite ? 'yes' : 'no', '?', $withWrite), $withWrite); $withWrite = $questionHelper->ask($input, $output, $question); $input->setOption('with-write', $withWrite); // format $format = $input->getOption('format'); $output->writeln(array('', 'Determine the format to use for the generated CRUD.', '')); $question = new Question($questionHelper->getQuestion('Configuration format (yml, xml, php, or annotation)', $format), $format); $question->setValidator(array('Sensio\\Bundle\\GeneratorBundle\\Command\\Validators', 'validateFormat')); $format = $questionHelper->ask($input, $output, $question); $input->setOption('format', $format); // route prefix $prefix = $this->getRoutePrefix($input, $entity); $output->writeln(array('', 'Determine the routes prefix (all the routes will be "mounted" under this', 'prefix: /prefix/, /prefix/new, ...).', '')); $prefix = $questionHelper->ask($input, $output, new Question($questionHelper->getQuestion('Routes prefix', '/' . $prefix), '/' . $prefix)); $input->setOption('route-prefix', $prefix); // controller folder? $controllerFolder = $input->getOption('controller-folder') ?: 'src/AppBundle/Controller/'; $output->writeln(array('', 'By default, the generator creates the controller on Controller namespace.', 'You can also generate it on an subnamespace (Ex: src/AppBundle/Controller/Backend).', '')); $question = new Question($questionHelper->getQuestion('Determine the subnamespace you want:', $controllerFolder), $controllerFolder); $controllerFolder = $questionHelper->ask($input, $output, $question); if ($controllerFolder == 'src/AppBundle/Controller/') { $controllerFolder = ''; } $input->setOption('controller-folder', $controllerFolder); // summary $output->writeln(array('', $this->getHelper('formatter')->formatBlock('Summary before generation', 'bg=blue;fg=white', true), '', sprintf('You are going to generate a CRUD controller for "<info>%s:%s</info>"', $bundle, $entity), sprintf('using the "<info>%s</info>" format.', $format), '')); }
/** * Get configured outputs. * * @param InputInterface $consoleInput * @param $config * @param $inputName * * @return mixed * * @throws \Exception */ protected function getOutputNames(InputInterface $consoleInput, ConfigContract $config, $inputName) { if ($consoleInput->hasArgument('output') && !empty($consoleInput->getArgument('output'))) { return [$consoleInput->getArgument('output')]; } if (isset($config->getInput($inputName)['to']) && is_string($config->getInput($inputName)['to'])) { return [$config->getInput($inputName)['to']]; } if (isset($config->getInput($inputName)['to']) && is_array($config->getInput($inputName)['to'])) { return $config->getInput($inputName)['to']; } throw new \Exception('No Output specified and configured.'); }
/** * {@inheritdoc} */ public function execute(InputInterface $input, OutputInterface $output) { $options = []; if ($input->hasOption('config-file')) { $configFile = $input->getOption('config-file'); if (!file_exists($configFile)) { throw new \RuntimeException(sprintf('Config file %s does not exist', $configFile)); } $options = (require $configFile); if (!is_array($options)) { throw new \RuntimeException(sprintf('Invalid config file specified or invalid return type in file %s', $configFile)); } } else { if ($input->hasArgument('json-schema-file') && null !== $input->getArgument('json-schema-file')) { $options['json-schema-file'] = $input->getArgument('json-schema-file'); } if ($input->hasArgument('root-class') && null !== $input->getArgument('root-class')) { $options['root-class'] = $input->getArgument('root-class'); } if ($input->hasArgument('directory') && null !== $input->getArgument('directory')) { $options['directory'] = $input->getArgument('directory'); } if ($input->hasArgument('namespace') && null !== $input->getArgument('namespace')) { $options['namespace'] = $input->getArgument('namespace'); } if ($input->hasOption('date-format') && null !== $input->getOption('date-format')) { $options['date-format'] = $input->getOption('date-format'); } if ($input->hasOption('no-reference') && null !== $input->getOption('no-reference')) { $options['reference'] = !$input->getOption('no-reference'); } } $options = $this->resolveConfiguration($options); $jane = \Joli\Jane\Jane::build($options); $files = $jane->generate($options['json-schema-file'], $options['root-class'], $options['namespace'], $options['directory']); foreach ($files as $file) { $output->writeln(sprintf("Generated %s", $file)); } }
/** * Execute command * * @param InputInterface $input Input instance * @param OutputInterface $output Output instance * * @return int|null|void */ public function execute(InputInterface $input, OutputInterface $output) { // Read grep value $grep = null; if ($input->hasArgument('grep')) { $grep = $input->getArgument('grep'); } $output->writeln('<h2>Starting debug log tail</h2>'); // Show log $logList = array('/var/log/apache2/error.log', '/var/log/php-fpm/dev.error.log'); $optionList = array('--mark-interval 5', '-n 0'); return $this->showLog($logList, $input, $output, $grep, $optionList); }
protected function execute(InputInterface $input, OutputInterface $output) { $installPath = $input->hasArgument('path') ? $input->getArgument('path') : null; $composerCmd = $input->hasArgument('composer_cmd') ? $input->getArgument('composer_cmd') : null; $io = $this->getIO(); try { $installer = Installer::getInstaller($composerCmd); } catch (\RuntimeException $e) { $io->writeError('ERROR: ' . $e->getMessage()); // TODO : Use verbosity levels to enable showing the stacktrace return self::RETURN_CODE_INSTALLER_INSTANTIATION_ERROR; } try { $installer->install($installPath, (bool) $input->getOption('verbose')); } catch (\RuntimeException $e) { $io->writeError('ERROR: ' . $e->getMessage()); // TODO : Use verbosity levels to enable showing the stacktrace return self::RETURN_CODE_INSTALLER_INSTALL_ERROR; } $io->write('<info>The Jupyter-PHP kernel has been successfully installed.</info>'); return self::RETURN_CODE_OK; }
/** * @param InputInterface $input * @return Factory */ protected function configureFileFactory(InputInterface $input) { $factory = $this->doxport->getFileFactory(); if ($input->hasArgument('data-dir') && $input->getArgument('data-dir')) { $factory->setPath($input->getArgument('data-dir')); } elseif ($input->hasOption('data-dir') && $input->getOption('data-dir')) { $factory->setPath($input->getOption('data-dir')); } if ($input->hasOption('format') && $input->getOption('format')) { $factory->setFormat($input->getOption('format')); } return $factory; }