Skip to content

Components/Console improvements #2074

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 4 commits into from
Jan 27, 2013
Merged

Components/Console improvements #2074

merged 4 commits into from
Jan 27, 2013

Conversation

Sgoettschkes
Copy link
Contributor

As mentioned in #1811, the ProgressHelper was moved into it's own document. I didn't change any text other than the headline.

As described in #2022, the select method from the DialogHelper was undocumented. I added this documentation, copying the example from the symfony blog (which I hope is ok).

provided a correct answer, the ``askAndValidate`` method. Both have
the disadvantage that you need to handle incorrect values yourself.

Instead, you can use the ``select`` method, which makes sure that the user
Copy link
Member

Choose a reason for hiding this comment

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

Use an API link here for the select method.

@Sgoettschkes
Copy link
Contributor Author

Thanks for the input @wouterj, I'll have a look and rework the things you mentioned!

@wouterj
Copy link
Member

wouterj commented Dec 30, 2012

I think you need to document all arguments, you are missing $attempts and $errorMessage right now (more information).

* ``attempts``: Maximum number of times to ask or ``false`` for infinite times
(default ``false``)
* ``errorMessage``: Error message to display when wrong answer is entered (default
``Value "%s" is invalid``)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if this is the right approach! The parameters are documented in the API description as well as in the code. Dublicating it does not seem very good. On the other hand if the default, attempts and errorMessage should be documented, the other options should also be mentioned to make it a complete documentation.

Copy link
Member

Choose a reason for hiding this comment

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

I think you can do something different than put them in a list with the description.

Above, you have this:

If the user enters an invalid string, an error message is shown and the user
is asked to provide the answer another time, till he enters a valid string.

You can make it something like this:

If the user enters an invalid string, an error message is shown and the user
is asked to provide the answer another time, till he enters a valid string
or the maximum attempts is reached (which you can define in the fifth
parameter). You can define your own error message in the sixth parameter.

@Sgoettschkes
Copy link
Contributor Author

I did the changes you mentioned. I also commented on one of my changes I'm not sure about!

$dialog = $app->getHelperSet()->get('dialog');
$colors = array('red', 'blue', 'yellow');

$colorKey = $dialog->select($output, 'Please select your favorite color (default to red)', $colors, 0);
Copy link
Member

Choose a reason for hiding this comment

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

This line will cause a horizontal scrollbar, I prefer something like this:

$colorKey = $dialog->select(
    $output,
    'Please select your favorite color (default to red)',
    $colors,
    0
);

Bugfixing a wording in the ProgressHelper
@Sgoettschkes
Copy link
Contributor Author

I improved the documentation as suggested. If the PR is ok, I would suggest I squash the commits to make a clean history before merging!

@wouterj
Copy link
Member

wouterj commented Jan 1, 2013

I think it's OK, great job! (and a happy new year 🎆 )

weaverryan added a commit that referenced this pull request Jan 27, 2013
Components/Console improvements
@weaverryan weaverryan merged commit 87710a8 into symfony:master Jan 27, 2013
@weaverryan
Copy link
Member

Fantastic job Sebastian - thanks for getting this done so nicely!

@Sgoettschkes Sgoettschkes deleted the issue2022 branch January 28, 2013 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants