addOption('key', 'k', InputOption::VALUE_REQUIRED, 'private key'); } protected function execute(InputInterface $input, OutputInterface $output) { $factory = $this->createFactory($input); $key = $input->getOption('key'); if (!$key) { throw new \RuntimeException('Key required!'); } $factory->savePrivateKey($key); $output->writeln('private key saved'); return 0; } }