Skip to content
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

Fix text options #121

Merged
merged 9 commits into from Apr 5, 2018

Conversation

@Jean85
Copy link
Member

Jean85 commented Apr 5, 2018

This PR attempts to fix a bug introduced with the new changes of the 0.12 release. Using input options with optional arguments it's really tricky with symfony/console!

I'm using a solution found in symfony/symfony#11572 (comment)

Jean85 added 6 commits Apr 5, 2018
This is to check that --text and --text-summary coverage options works
even without any passed arguments
@Jean85 Jean85 added the bug label Apr 5, 2018
@Jean85 Jean85 self-assigned this Apr 5, 2018
Jean85 added 2 commits Apr 5, 2018
@Jean85 Jean85 merged commit efd3f26 into master Apr 5, 2018
0 of 2 checks passed
0 of 2 checks passed
Scrutinizer Running
Details
codeclimate Code Climate is analyzing this code.
Details
@Jean85 Jean85 deleted the fix-text-options branch Apr 5, 2018
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request May 27, 2018
…roblem (Jean85, javiereguiluz)

This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #9560).

Discussion
----------

Add 2 solutions for the 'option with optional argument' problem

While working on facile-it/paraunit#121, I discovered a tricky case with the Console component: using an option with an optional argument seemed impossible! The doc said:

> There is nothing forbidding you to create a command with an option that optionally accepts a value. However, there is no way you can distinguish when the option was used without a value (command --language) or when it wasn't used at all (command). In both cases, the value retrieved for the option will be null.

This is NOT TRUE. I've found two possible solutions to this issue (one myself, one in symfony/symfony#11572 (comment)) and this PR introduces them in the docs. I've also moved around the two tips/cautions which were at the end of the article, because with my reword it seemed nicer to me.

Commits
-------

d3f254d Minor simplifications
1aad365 Minor reword
99f9e3f Simplify the explanation leaving just one solution
a05b002 Add 2 solutions for the 'option with optional argument' problem
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request May 27, 2018
…roblem (Jean85, javiereguiluz)

This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #9560).

Discussion
----------

Add 2 solutions for the 'option with optional argument' problem

While working on facile-it/paraunit#121, I discovered a tricky case with the Console component: using an option with an optional argument seemed impossible! The doc said:

> There is nothing forbidding you to create a command with an option that optionally accepts a value. However, there is no way you can distinguish when the option was used without a value (command --language) or when it wasn't used at all (command). In both cases, the value retrieved for the option will be null.

This is NOT TRUE. I've found two possible solutions to this issue (one myself, one in symfony/symfony#11572 (comment)) and this PR introduces them in the docs. I've also moved around the two tips/cautions which were at the end of the article, because with my reword it seemed nicer to me.

Commits
-------

7be002b Add 2 solutions for the 'option with optional argument' problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.