Skip to content

Commit

Permalink
edit for single answer mc
Browse files Browse the repository at this point in the history
  • Loading branch information
dvnc0 committed Aug 26, 2023
1 parent 95f14e9 commit 430c613
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/App/Tools/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ public function multipleChoice(string $message, array $options, $default = [], $
break;
case "\n": // enter
$out = [];
if ($single_answer_only) {
$out[] = $options[$index];
fclose($stdin);
system('stty sane');
return $out;
}
foreach ($selected as $key) {
$out[] = $options[$key];
}
Expand All @@ -168,9 +174,7 @@ public function multipleChoice(string $message, array $options, $default = [], $
case " ": // space
if ($single_answer_only) {
$out = [];
foreach ($selected as $key) {
$out[] = $options[$key];
}
$out[] = $options[$index];
fclose($stdin);
system('stty sane');
return $out;
Expand Down

0 comments on commit 430c613

Please sign in to comment.