Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Console] Added better interaction for choice questions#11326
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
i think putting @api on the class is enough. I mean I would assume it would have methods unshakable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Actually,@api shoulmd never be added in a PR submitting the code. you cannot make it part of the stable API if it is not even part of the codebase.
We will mark it as part of the stable API only a bit later
florianv commentedJul 7, 2014
I was thinking that this helper could replace the current one for choice questions only when publicfunctionask(InputInterface$input,OutputInterface$output,Question$question){if ($this->hasSttyAvailable() &&$questioninstanceof ChoiceQuestion) {return$this->helperSet->get('choice_question') ->ask($input,$output,$question); }return$this->helperSet->get('generic_question') ->ask($input,$output,$question);} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Note that here I pull the cursor left of 10 000 columns to avoid usingmb_strlen (maybe less should be enough too).
stof commentedJul 8, 2014
IMO, it does not mak sense to have a separate helper for choice questions. It makes things harder to use for developers, by requiring to choose the right helper (or they will always use the |
florianv commentedJul 8, 2014
I didn't put it in the What I could do is to put the default handling fromhttps://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Helper/QuestionHelper.php#L110 in a separate command like What do you think@stof ? |
florianv commentedJul 11, 2014
I have updated the PR, so it keeps only the |
florianv commentedJul 11, 2014
Btw, it would be nice if someone without |
florianv commentedJul 17, 2014
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't like these options. They are making the helper stateful, which is causing issues (it means asking a question in one place will have side effects on next questions in other places).
The configuration should be part of the Question object instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes but I think when you want to configure the templates, you want to do it globally for all questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
but here, your options are mutable. This means that some code using the helper can decide to change the options, and this will impact unrelated code (which was expecting to use the defaults).
If the goal is to configure them globally, they should not be mutable by code using the helper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes it's better to attach them to the Question as you propose. Thanks
eko commentedJul 17, 2014
This is a great addition, a much better way to give answers, user-friendly 👍 |
mickaelandrieu commentedJul 17, 2014
👍 |
florianv commentedJul 17, 2014
Thanks for reviewing@stof, I have addressed your comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm not sure these utility classes/Interface should actually be in the root of the component (I don't have a good idea for the naming of a subnamespace holding them though).
also, Symfony uses a final class with a private constructor for enums, not an interface (it would not make sense for someone to implement this interface)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
MaybeIOUtil or something like that ?
jjsaunier commentedJul 17, 2014
👍 |
florianv commentedOct 31, 2014
fabpot commentedMar 31, 2018
@ro0NL Probably one that you could be interested in taking over :) |
vudaltsov commentedJun 28, 2019
I guess, this PR could be closed after#26698. |
This PR adds a more user friendly way to ask choice questions when
sttyis available.Single choice question
You can move up and down with the arrow keys.
To validate your choice press
enter.Multi choice question
You can move up and down with the arrow keys.
To select / deselect a choice press the
spacebar.To validate your choices press
enter.Todos: