Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/Cli/Command/Issue/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->stdErr->writeln('<error>No branches found for this issue on the fork.</error>');
return 1;
}
if (!self::$interactive) {
if (count($issueBranches) === 1) {
$branchArg = $issueBranches[0];
$this->stdOut->writeln(sprintf('<info>Auto-selected branch %s.</info>', $branchArg));
} elseif (!self::$interactive) {
$this->stdErr->writeln('<error>No branch specified. Available branches:</error>');
foreach ($issueBranches as $b) {
$this->stdErr->writeln(' ' . $b);
}
return 1;
} else {
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new \Symfony\Component\Console\Question\ChoiceQuestion(
'Select a branch to check out:',
$issueBranches
);
$branchArg = $helper->ask($input, $output, $question);
}
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new \Symfony\Component\Console\Question\ChoiceQuestion(
'Select a branch to check out:',
$issueBranches
);
$branchArg = $helper->ask($input, $output, $question);
}

$checkoutProcess = new Process([
Expand Down