Is there a way to have a default answer for the ask() methods?
eliottchampault opened this issue · 3 comments
Hello there,
Thank you so much for this amazing package. I am sorry to create and issue as this is more of a question.
Would it be possible to have a default answer for the ask() method? Something "a la" Symfony\Component\Console\Question\ConfirmationQuestion;
where the second param (I believe optional) is the default aswer in case the user press the 'return' key.
Let me know.
All the best
Eliott
Hey Elliot, we will probably remove ask
from Termwind core api, and it will have its own plugin in the future with all of that support.
Thanks.
Excellent.
Is there a roadmap for Termwind?
I would love to know where this is heading as I am starting to use it heavily.
Best
Eliott
PS: sorry to be reaching you like this...
For anyone still looking a quick default like functionality you can easily extend ask
like this
function ask(string $question, mixed $default = NULL): mixed {
$return = \Termwind\ask($question, NULL);
if ($return === '') {
return $default;
}
return $return;
}