laravel / prompts

Beautiful and user-friendly forms for your command-line PHP applications.
https://laravel.com/docs/prompts
MIT License
533 stars 94 forks source link

[Feature] Automatic validation option upon toggling multi-select prompts #121

Closed GoodM4ven closed 8 months ago

GoodM4ven commented 8 months ago

I found this to be cool when it's accompanied with the next PR, which is about introducing re-evaluated and cached options closure; resulting in a reactive experience... Basically, it's what I was a bit confused about in #116 .

If you like it, should I do the docs?

jessarcher commented 8 months ago

Hey @GoodM4ven, thanks for your PR!

I'm not sure it's worth adding an additional function parameter for this. I'd need to see some compelling use cases or multiple people experiencing an issue with the current behaviour.

Just to explain the reasoning behind the current behaviour, the delayed validation is intended to prevent an error message from being displayed before the user has had a chance to finish their input. This is primarily for text-based inputs where a user may be part-way through typing an email address. It also applies with multi-selects where the rule may be that they need to select a minimum number of options, and we don't want to display an error when they've chosen only one if they were already planning on selecting more.