Skip to content

Commit

Permalink
Fix: Default input
Browse files Browse the repository at this point in the history
  • Loading branch information
JBlond committed Dec 16, 2024
1 parent 039af24 commit 86b9053
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/jblond/cli/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 86b9053

Please sign in to comment.