/**
  * Get the value of a command argument.
  *
  * @param  string  $key
  * @return string|array
  */
 public function argument($key = null)
 {
     if (is_null($key)) {
         return $this->input->getArguments();
     }
     return $this->input->getArgument($key);
 }
 /**
  * @return bool
  */
 protected function isUpdateWithoutArguments()
 {
     $arguments = $this->input->getArguments();
     if (!$this->input->getOption('dry-run') && $arguments['command'] === 'update' && count($arguments['packages']) === 0) {
         return true;
     }
     return false;
 }
 /**
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // handle everything that is not an actual exception
     set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) use($input) {
         // error was suppressed with the @-operator
         if (0 === error_reporting()) {
             return false;
         }
         $extra = array();
         $tags = array();
         $extra["full_command"] = implode(" ", $_SERVER['argv']);
         $arguments = $input->getArguments();
         $tags["command"] = $arguments["command"];
         $this->dialogProvider->logException(new SkylabException($errstr, 0, $errno, $errfile, $errline, null, array()), $tags, $extra);
     }, E_ALL);
     /** @var \Cilex\Application $app */
     $app = $this->getContainer();
     try {
         $this->setup($app, $input, $output, true);
         $this->doPreExecute();
         $this->doExecute();
         $this->doPostExecute();
     } catch (\Exception $ex) {
         $extra = array();
         $tags = array();
         $extra["full_command"] = implode(" ", $_SERVER['argv']);
         $arguments = $input->getArguments();
         $tags["command"] = $arguments["command"];
         $this->dialogProvider->logException($ex, $tags, $extra);
     }
 }
Example #4
0
 /**
  * Executes the current command
  *
  * @param use Symfony\Component\Console\Input\InputInterface $input
  * @param use Symfony\Component\Console\Input\OutputIterface $output
  *
  * @return null|int null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->arguments = $input->getArguments();
     $this->options = $input->getOptions();
     $files = $this->collectFiles($this->arguments['source']);
     if (!count($files)) {
         $output->writeln('<comment>No task found! Please check your source path.</comment>');
         exit;
     }
     // List of schedules
     $schedules = [];
     foreach ($files as $file) {
         $schedule = (require $file->getRealPath());
         if (!$schedule instanceof Schedule) {
             continue;
         }
         // We keep the events which are due and dismiss the rest.
         $schedule->events($schedule->dueEvents());
         if (count($schedule->events())) {
             $schedules[] = $schedule;
         }
     }
     if (!count($schedules)) {
         $output->writeln('<comment>No event is due!</comment>');
         exit;
     }
     // Running the events
     (new EventRunner())->handle($schedules);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = new Config();
     $config->setBasePath(getcwd());
     $config->setFromArray($input->getArguments());
     $config->setFromArray(array('bare' => $input->getOption('bare')));
     $moduleConfig = new ConfigWriter($config);
     $state = new State($moduleConfig);
     $builder = new FullContainer($config);
     $builder->prepare($state);
     $builder->build($state);
     $writeState = new State($moduleConfig);
     $models = array('service' => $state->getServiceModel(), 'factory' => $state->getModel('service-factory'), 'trait' => $state->getModel('service-trait'), 'test' => $state->getModel('service-test'));
     foreach (array_keys($models) as $key) {
         if ($input->getOption('no-' . $key)) {
             $models[$key] = false;
         }
         if ($input->getOption('only-' . $key)) {
             foreach (array_keys($models) as $index) {
                 if ($key != $index) {
                     $models[$index] = false;
                 }
             }
         }
     }
     foreach ($models as $model) {
         if ($model) {
             $writeState->addModel($model);
         }
     }
     $writer = new ModelWriter($config);
     $writer->write($writeState, $output);
     $moduleConfig->save($output);
 }
Example #6
0
 /**
  * Retrieves argument value
  *
  * @param string|null $key The key
  *
  * @return string|array
  */
 public function argument(string $key = null)
 {
     if ($key === null) {
         return $this->input->getArguments();
     }
     return $this->input->getArgument($key);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $arguments = $input->getArguments();
     // Disable error reporting for shopware menu legacy hack
     $this->registerErrorHandler($output);
     /** @var Installer $themeInstaller */
     $themeInstaller = $this->container->get('theme_installer');
     $themeInstaller->synchronize();
     if ($this->getRepository()->findOneByTemplate($arguments['template'])) {
         $output->writeln('A theme with that name already exists');
         return 1;
     }
     /** @var Template $parent */
     $parent = $this->getRepository()->findOneByTemplate($arguments['parent']);
     if (!$parent instanceof Template) {
         $output->writeln(sprintf('Shop template by template name "%s" not found', $arguments['parent']));
         return 1;
     }
     if ($parent->getVersion() < 3) {
         $output->writeln(sprintf('Shop template by template name "%s" is not a Shopware 5 Theme!', $arguments['parent']));
         return 1;
     }
     $arguments = array_merge($arguments, $this->dialog($input, $output));
     /** @var Generator $themeGenerator */
     $themeGenerator = $this->container->get('theme_generator');
     $themeGenerator->generateTheme($arguments, $parent);
     $output->writeln(sprintf('Theme "%s" has been created successfully.', $arguments['name']));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $options = array_merge($input->getArguments(), $input->getOptions());
     var_dump($options);
     $this->getClient()->updateAutoScalingGroup($options);
     return self::COMMAND_SUCCESS;
 }
Example #9
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $args = $input->getArguments();
     $config = $this->getZyncroAppConfig($args['namespace']);
     $helper = new QuestionHelper();
     $newParameters = array();
     if ($config) {
         $output->writeln('');
         $parameters = $this->getParametersFromConfig($config);
         foreach ($parameters as $parameter) {
             if (!isset($newParameters[$parameter['block']])) {
                 $newParameters[$parameter['block']] = array();
             }
             $question = new Question('Set value for parameter <fg=green>' . $parameter['key'] . '</fg=green> of block <fg=green>' . $parameter['block'] . '</fg=green> (default: <fg=yellow>' . $parameter['value'] . '</fg=yellow>): ', $parameter['value']);
             $newParameters[$parameter['block']][$parameter['key']] = $helper->ask($input, $output, $question);
         }
         $dataSaved = $this->saveZyncroAppConfig($args['namespace'], $newParameters);
         if ($dataSaved) {
             $output->writeln('');
             $output->writeln('<info>The new configuration for the ZyncroApp with the namespace ' . $args['namespace'] . ' has been saved</info>');
             $output->writeln('');
         }
     } else {
         $output->writeln('<error>ZyncroApp with namespace ' . $args['namespace'] . ' is not found or doesn\'t have a config.yml file</error>');
     }
 }
Example #10
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $data = $input->getArguments();
     /** @var Connection $conn */
     $conn = $this->getContainer()->get('database_connection');
     $conn->insert('queues', $data);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $arguments = $input->getArguments();
     $arguments['limit'] = $input->getOption('limit');
     $issues = $this->issuesFactory->getIssues($arguments);
     if (isset($issues['issues'])) {
         $tableIssues = [];
         foreach ($issues['issues'] as $key => $issue) {
             // new table layout
             $estimate = '';
             if (isset($issue['estimated_hours'])) {
                 $estimate = str_pad($issue['estimated_hours'], 4, ' ', STR_PAD_LEFT) . 'h';
             }
             $projectId = str_pad($issue['project']['id'], 3, ' ', STR_PAD_LEFT);
             $tableIssues[$key] = ['id' => "<comment>{$issue['id']}</comment>", 'project' => "[{$projectId}] " . substr($issue['project']['name'], 0, 10), 'name' => substr($issue['subject'], 0, 40), 'status' => substr($issue['status']['name'], 0, 8), 'est.' => $estimate];
         }
         if (!empty($tableIssues)) {
             $table = new Table($output);
             $table->setHeaders(array_keys($tableIssues['0']))->setRows($tableIssues);
             $table->render();
         }
         if ($issues['total_count'] == 0) {
             $output->writeln('No issues found: <comment>' . json_encode($arguments) . '</comment>');
         }
     }
     if (isset($issues['0']) && $issues['0'] == false) {
         $output->writeln('No issues found: <comment>' . json_encode($arguments) . '</comment>');
     }
 }
Example #12
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $args = $input->getArguments();
     $first = array_shift($args);
     // If the first argument is an alias, assign the next argument as the
     // command.
     if (strpos($first, '@') === 0) {
         $alias = $first;
         $command = array_shift($args);
     } else {
         $alias = '@self';
         $command = $first;
     }
     $options = $input->getOptions();
     // Force the 'backend' option to TRUE.
     $options['backend'] = TRUE;
     $return = drush_invoke_process($alias, $command, array_values($args), $options, ['interactive' => TRUE]);
     if ($return['error_status'] > 0) {
         foreach ($return['error_log'] as $error_type => $errors) {
             $output->write($errors);
         }
         // Add a newline after so the shell returns on a new line.
         $output->writeln('');
     } else {
         $output->page(drush_backend_get_result());
     }
 }
Example #13
0
 /**
  * Executes the current command
  *
  * @param use Symfony\Component\Console\Input\InputInterface $input
  * @param use Symfony\Component\Console\Input\OutputIterface $output
  *
  * @return null|int null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $args = [];
     $this->arguments = $input->getArguments();
     parse_str($this->arguments['closure'], $args);
     $serializer = new Serializer();
     call_user_func_array($serializer->unserialize($args[0]), []);
 }
 public function execute(InputInterface $input, OutputInterface $output)
 {
     if (count($input->getArguments()) === 0) {
         $definition = $this->getDefinition();
         $input = new ArgvInput(null, $definition);
     }
     return parent::execute($input, $output);
 }
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $options = array_merge($input->getArguments(), $input->getOptions());
     $options['BlockDeviceMappings'] = json_decode($options['BlockDeviceMappings']);
     $result = $this->getClient()->createImage($options);
     $output->writeln('AMI Image created with id ' . $result->get('ImageId'));
     return self::COMMAND_SUCCESS;
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configuration = array_merge($input->getArguments(), $input->getOptions());
     $this->routeService->configureRouteObject($configuration);
     $message = $this->routeService->executeCommand();
     $output->writeln("<info>Route Added to -- {$this->routeService->getRouteObject()->get('module')} Module Config File --</info>");
     $output->writeln("<comment>{$message}</comment>");
 }
 /**
  * Prepare config
  *
  * @param InputInterface $input
  */
 protected function prepareConfig(InputInterface $input)
 {
     $this->config = new Config();
     $this->config->setBasePath(getcwd());
     $this->config->setFromArray($input->getArguments());
     $this->config->setFromArray($input->getOptions());
     $this->configWriter = new ConfigWriter($this->config);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configuration = array_merge($input->getArguments(), $input->getOptions());
     $this->routeService->configureRouteObject($configuration);
     $message = $this->routeService->executeCommand();
     // I want to move this into the service so that I can just throw the $message into writeln and forget about it
     $output->writeln("<info>Route Updated in -- {$this->routeService->getRouteObject()->get('module')} Module Config File --</info>");
 }
 public function basicGetArgumentsWithoutSelf(InputInterface $input)
 {
     $args = $input->getArguments();
     if (is_array($args) && array_key_exists('command', $args)) {
         unset($args['command']);
     }
     return $args;
 }
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return null|int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $claims = array_filter($input->getArguments(), function ($claim) {
         return $claim !== 'command';
     }, ARRAY_FILTER_USE_KEY);
     $token = $this->getEncoderService()->encode($claims);
     $output->writeln(['', $token]);
 }
 /**
  * ControladorModulo::execute()
  * 
  * ejecuta el proceso correspondiente de la
  * consola
  * 
  * @param object $input
  * @param object $output
  * @return raw
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->parametro = $input->getArguments();
     if (ConfigAcceso::appExistencia($this->parametro['app']) == true) {
         $this->existenciaDirectorio($input, $output);
     } else {
         throw new \RuntimeException(sprintf('La aplicación: [ %s ] no existe en el archivo de configuración', $this->parametro['app']));
     }
 }
 /**
  * Executes the current command.
  *
  * @param InputInterface  $input  An InputInterface instance.
  * @param OutputInterface $output An OutputInterface instance.
  *
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $application = $this->getApplication();
     $command = $application->find('validate');
     $command->ignoreValidationErrors();
     $arguments = $input->getArguments();
     $arguments['schema'] = $this->getSchemaUrl();
     return $command->run(new ArrayInput($arguments), $output);
 }
 /**
  * Desarrollo::execute()
  * 
  * ejecuta el proceso correspondiente de la
  * consola
  * 
  * @param object $input
  * @param object $output
  * @return raw
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->param = (object) $input->getArguments();
     if (ConfigAcceso::appExistencia($this->param->app) == true) {
         $this->seleccionPeticion($input, $output);
     } else {
         throw new \RuntimeException(sprintf('La aplicación: [ %s ] no existe en el archivo de configuración', $this->param->app));
     }
 }
 /**
  * Loop through the years to calculate the profit
  *
  * @access public
  * @param InputInterface $input
  * @return array
  */
 public function getInvestmentResults(InputInterface $input)
 {
     $this->input = $input->getArguments();
     $this->setBaseInformation();
     for ($year = 0; $year <= $this->results['years']; $year++) {
         $this->calculateResultForYear($year);
     }
     return $this->results;
 }
 /**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->getMessenger()->info(sprintf('Send deployment notification to New Relic for %s', $input->getArgument(self::ARGUMENT_APPLICATION_NAME)));
     $arguments = $input->getArguments();
     unset($arguments['command']);
     $newRelicApi = $this->getFactory()->getNewRelicApi();
     $newRelicApi->recordDeployment($arguments);
     return 0;
 }
Example #26
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var ChangelogWriter $changelogWriter */
     $changelogWriter = $this->getContainer()->get('ChangelogWriter');
     $filename = $input->getOption('file');
     $changelogWriter->write($filename, array_merge($input->getArguments(), $input->getOptions()));
     $output->writeln("Changelog generated {$filename}");
     return 0;
 }
Example #27
0
 /**
  * {@inheritdoc}
  */
 public function run(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     //We can refill internal options as we don't need them at this stage
     $this->options = $this->input->getOptions();
     $this->arguments = $this->input->getArguments();
     return parent::run($input, $output);
 }
Example #28
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->core();
     $this->prepare_db($input->getOption('database'));
     $importer = new FSDriver($input->getArgument('site_id'), $input->getArgument('pid'));
     $importer->dry_run($input->getOption('dry-run'));
     $importer->with_clean($input->getOption('clean'));
     $importer->import($input->getArguments());
     $importer->done();
 }
Example #29
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $composer = $this->getComposer();
     $binDir = $composer->getConfig()->get('bin-dir');
     if (is_dir($binDir)) {
         $_SERVER['PATH'] = realpath($binDir) . PATH_SEPARATOR . getenv('PATH');
         putenv('PATH=' . $_SERVER['PATH']);
     }
     $args = $input->getArguments();
     return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
 }
 /**
  * Execute the console command.
  *
  * @param  \Symfony\Component\Console\Input\InputInterface  $input
  * @param  \Symfony\Component\Console\Output\OutputInterface  $output
  * @return mixed
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $inputs = array_merge($input->getArguments(), $input->getOptions());
     $parameters = [];
     foreach ((new ReflectionFunction($this->callback))->getParameters() as $parameter) {
         if (isset($inputs[$parameter->name])) {
             $parameters[$parameter->name] = $inputs[$parameter->name];
         }
     }
     return $this->laravel->call($this->callback->bindTo($this, $this), $parameters);
 }