Ejemplo n.º 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->setInputOutput($input, $output);
     $this->config = Config::factory($this->provider, true);
     $this->boot();
     $this->output->writeln(PHP_EOL);
     $this->startProgress(null);
     $this->ensureConfigExists();
     $this->setProgressMessage('Creating "' . $this->provider . '" provider instance.');
     $this->providerInstance = $this->createProvider($this->config, $this->options);
     $this->advanceProgress();
     $this->setProgressMessage('Sending data..');
     // Call actual command handler
     $this->setResponse($this->handle($input, $output));
     $this->advanceProgress();
     $this->setProgressMessage('[' . $this->provider . '] ' . $this->getResponse()->getMessage());
     $this->finishProgress();
 }
Ejemplo n.º 2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $provider = $input->getArgument('provider');
     $baseDir = $_SERVER['HOME'] . DIRECTORY_SEPARATOR . '.slackpipe';
     if (!is_dir($_SERVER['HOME'] . DIRECTORY_SEPARATOR . '.slackpipe')) {
         mkdir($baseDir);
     }
     $config = Config::factory($provider);
     // Custom Handler
     if ($class = Asserts::hasCustomSetup($provider)) {
         $command = new $class($this, $config);
         $command->handle($input, $output);
     } else {
         $helper = $this->getHelper('question');
         $question = new Question('Please enter your token: ', false);
         $token = $helper->ask($input, $output, $question);
         if ($config->write(['token' => $token]) !== false) {
             $output->writeln('Token written to file: ' . $config->filePath());
         } else {
             $output->writeln('Nothing written..');
         }
     }
 }