From f0ee82121e8fbd62caab90fef718845c2cef010a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 7 Sep 2017 00:24:47 +0300 Subject: [PATCH] use default answer if it is valid --- src/Command/CloseIssueCommand.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Command/CloseIssueCommand.php b/src/Command/CloseIssueCommand.php index 88bebd5..ad89c69 100644 --- a/src/Command/CloseIssueCommand.php +++ b/src/Command/CloseIssueCommand.php @@ -173,6 +173,11 @@ private function getMessage() */ private function askChoices($prompt, $list, $errorMessage, $default = null) { + // default given and present in $list, use that + if ($default && isset($list[$default])) { + return $default; + } + // avoid asking if answer is known switch (count($list)) { case 0: