diff --git a/src/Cli/Command/Issue/Checkout.php b/src/Cli/Command/Issue/Checkout.php
index 170f25f..ebe342d 100644
--- a/src/Cli/Command/Issue/Checkout.php
+++ b/src/Cli/Command/Issue/Checkout.php
@@ -96,20 +96,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->stdErr->writeln('No branches found for this issue on the fork.');
return 1;
}
- if (!self::$interactive) {
+ if (count($issueBranches) === 1) {
+ $branchArg = $issueBranches[0];
+ $this->stdOut->writeln(sprintf('Auto-selected branch %s.', $branchArg));
+ } elseif (!self::$interactive) {
$this->stdErr->writeln('No branch specified. Available branches:');
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([