protected function execute(InputInterface $input, OutputInterface $output) { /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); $this->parseInput($input, $output); $issueParser = new IssueParser(); $importService = new ImportService($this->owner, $this->repo, $this->auth); $issues = $issueParser->parseJsonFileToIssues($this->filename); $output->writeln(''); $output->writeln('<info>Found ' . count($issueParser->getUsers()) . ' users in BitBucket</info>'); $output->writeln('<info>Select GitHub user from the following list for each BitBucket user, or leave empty to skip</info>'); $githubUsers = $importService->listUsers(); $output->writeln('<info>Available GitHub users:</info>'); foreach ($githubUsers as $index => $githubUser) { $output->writeln("{$index}) {$githubUser}"); } /** @var User $assignee */ foreach ($issueParser->getUsers() as $assignee) { $userIndex = $helper->ask($input, $output, new Question('BitBucket user ' . $assignee->getBitbucket() . ': ')); if ($userIndex != null) { $assignee->setGithub($githubUsers[$userIndex]); } } $output->writeln(''); $output->writeln('<info>Parsed ' . count($issues) . ' issues from the json file</info>'); $importQuestion = new ConfirmationQuestion("Continue to import these to {$this->owner}/{$this->repo}? (y/N)", false); $importConfirmQuestion = new ConfirmationQuestion("Are you sure you want to import these to {$this->owner}/{$this->repo}? This can not be reverted. (y/N)", false); if (!$helper->ask($input, $output, $importQuestion) || !$helper->ask($input, $output, $importConfirmQuestion)) { $output->writeln('Aborting'); return; } $progress = new ProgressBar($output, count($issues)); $progress->start(); foreach ($issues as $issue) { $importService->createAndUpdateIssue($issue); $progress->advance(); } $progress->finish(); $output->writeln('Import done!'); }