protected function execute(InputInterface $input, OutputInterface $output) { $provider = $input->getArgument('provider'); $baseDir = $_SERVER['HOME'] . DIRECTORY_SEPARATOR . '.slackpipe'; /** @var ConfigInterface $config */ $config = Config::factory($provider); // Custom Handler if ($class = Asserts::hasCustomSetup($provider)) { $command = new $class($this, $config); if (method_exists($command, 'remove')) { $command->remove($input, $output); } } else { $configPath = $config->filePath(); if ($config->exists()) { unlink($configPath); $output->writeln('Config removed: ' . $configPath); } else { $output->writeln('Config not found.'); } } }
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..'); } } }