Skip to content

Commit a80ba37

Browse files
committed
2 parents 41db27d + e799fc4 commit a80ba37

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Component/Interact/Choose.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@ public static function one(string $description, $options, $default = null, bool
5757
$text .= "\n <info>$key</info>) $value";
5858
}
5959

60-
$defaultText = $default ? "[default:<comment>$default</comment>]" : '';
60+
$defaultText = $default ? "[default:<info>$default</info>]" : '';
6161
Console::write($text);
6262

6363
beginChoice:
6464
$r = Console::readln("Your choice$defaultText : ");
6565

66+
if ($r === '' && $default !== null) {
67+
return $default;
68+
}
69+
6670
// error, allow try again once.
6771
if (!array_key_exists($r, $options)) {
6872
goto beginChoice;

0 commit comments

Comments
 (0)