private function parseInput(InputInterface $input, OutputInterface $output) { /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); /* * Filename */ $this->filename = $input->getOption('filename'); if (empty($this->filename)) { $this->filename = $helper->ask($input, $output, new Question('Json file to import: ')); } if (!file_exists($this->filename)) { throw new \Exception('File not found'); } /* * Owner */ $this->owner = $input->getOption('owner'); if (empty($this->owner)) { $this->owner = $helper->ask($input, $output, new Question('Owner of GitHub repository, organization or a person: ')); } if (empty($this->owner)) { throw new \Exception('Empty owner'); } /* * Repo */ $this->repo = $input->getOption('repo'); if (empty($this->repo)) { $this->repo = $helper->ask($input, $output, new Question('GitHub repository name: ')); } if (empty($this->repo)) { throw new \Exception('Empty repo'); } /* * username */ $username = $input->getOption('username'); if (empty($username)) { $username = $helper->ask($input, $output, new Question('GitHub username to log in with: ')); } if (empty($username)) { throw new \Exception('Empty username'); } $this->auth = new Auth($username); if ($helper->ask($input, $output, new Question('Do you use 2 factor auth for GitHub? (y/N) '))) { $question = new Question('GitHub personal token (https://github.com/settings/tokens) with repo access: '); $token = $helper->ask($input, $output, $question); $this->auth->setToken($token); } else { $password = $helper->ask($input, $output, new Question('GitHub password: ')); $this->auth->setPassword($password); } }