diff --git a/src/jblond/cli/Cli.php b/src/jblond/cli/Cli.php index 0411d4f..2179aeb 100644 --- a/src/jblond/cli/Cli.php +++ b/src/jblond/cli/Cli.php @@ -33,10 +33,13 @@ public function input(string $prompt, $validInputs, string $default = ''): strin ) ){ echo $prompt; - $input = trim(fgets(fopen('php://stdin', 'rb'))); if(empty($input) && !empty($default)) { $input = $default; } + else + { + $input = trim(fgets(fopen('php://stdin', 'rb'))); + } } return $input; }