8000 [Console] [Question helper] Add more accuracy from a list of answers by devojifr · Pull Request #19105 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Console] [Question helper] Add more accuracy from a list of answers #19105

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/console/helpers/questionhelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ Let the User Choose from a List of Answers

If you have a predefined set of answers the user can choose from, you
could use a :class:`Symfony\\Component\\Console\\Question\\ChoiceQuestion`
which makes sure that the user can only enter a valid string
from a predefined list::
which makes sure that the user can only enter a valid string or the index
of the choice from a predefined list. In the example below, typing ``blue``
or ``1`` is the same choice for the user. A default value is set with ``0``
but ``red`` could be set instead (could be more explicit)::

use Symfony\Component\Console\Question\ChoiceQuestion;

Expand Down
0