-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[10.x] Document Laravel Prompts & prompting for missing input. #8924
Conversation
Two questions based on your Laracon 2023 presentation: Laravel\Prompts\select Can it be optional ? It seems that "no selection" is not possible. Laravel\Prompts\confirm Is there a way to not select any of the options ? So we make sure the user really select something instead of only pressing the enter key. Can there be more than 2 options ? |
Also, you specify that for Windows, it's only working with WSL because the windows php exe is missing some stuff (readline module I think?) So am I right to say that it's not a windows terminal problem but a php compilation problem ? Thanks ! |
There's nothing built-in to make it optional, but you can add an option named "None" (or whatever wording is appropriate for your prompt) and check whether it was the selected option. For example, this is what we'll be doing in the Laravel installer: I had considered trying to make it optional, but I couldn't come up with an intuitive UI that was any better than just adding a custom "None" option.
Not at the moment, but you can specify the default as
I would just use the |
You are correct about readline. Even with the readline module included, Windows is missing many of the functions: https://stackoverflow.com/a/71178783 An alternative approach is using the Unix In either case, the terminal application itself doesn't matter. We'd either need an equivalent to the It comes down to the following main requirements:
We also need to intercept This isn't an issue for Symfony's prompts because the user input is always the very last thing on the screen, and none of the prompts require the arrow keys (although they can optionally be used in supported environments). The experience is still degraded on Windows, but Symfony's UI choices allow for that at the cost of limiting the UI possibilities in other environments. |
@jessarcher Thanks for all your answers. You answered all my questions. Have a nice day and thanks for providing us with such a great addition. |
This PR adds documentation for Laravel Prompts.
I've also included documentation for the existing
PromptsForMissingInput
functionality.