Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] Added the ability to return the default answer in a question #11975

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

Conversation

ThomasLomas
Copy link

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets none
License MIT
Doc PR symfony/symfony-docs#4254

This gives the option of showing the default answer along with the question. The documentation is a work in progress.

@ThomasLomas ThomasLomas force-pushed the console_question_return_default branch from eb10681 to 756103d Compare September 21, 2014 16:29
@ThomasLomas ThomasLomas changed the title [WIP] [Console] Added the ability to return the default answer in a question [Console] Added the ability to return the default answer in a question Sep 21, 2014
*
* @return Question The current instance
*/
public function setShowDefault($showDefault)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about setting a default of true?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should be more explicit and require true to be passed. Another opinion please?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wouterj You mean line 28 not the method parameter, don't you?

@wouterj
Copy link
Member

wouterj commented Sep 21, 2014

👍

@@ -25,6 +25,7 @@ class Question
private $autocompleterValues;
private $validator;
private $default;
private $showDefault = false;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about usability, should the default be shown by default?

@kbond
Copy link
Member

kbond commented Sep 24, 2014

With the changes being made to the helpers to adhere to the style guide I wonder if this should be done in the QuestionHelper?

Also, according to the current draft of the style guide the output should be:
<info>{message}</info> [<comment>{default}</comment><info>:</info>

@stof
Copy link
Member

stof commented Sep 25, 2014

IMO, this is the wrong implementation. Putting the default as part of the message returned by Question::getQuestion will not allow followign the styleguide. The default value needs to be highlighted in a different color than the question.
So getQuestion should not change, and the display of the question in QuestionHelper should be updated instead (the default can already be retrieved).

@fabpot
Copy link
Member

fabpot commented Feb 5, 2015

@ThomasLomas Can you take into account the comments from @stof and update the PR accordingly?

@wouterj
Copy link
Member

wouterj commented Apr 27, 2015

Considering that there now is a SymfonyStyle feature (which, among other things, adds the default value to the question) is this PR still relevant?

@ThomasLomas
Copy link
Author

As a result I think this can be closed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants