Skip to content

Using Command Options describes missing feature #4110

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

Closed
EdwardIII opened this issue Aug 8, 2014 · 7 comments
Closed

Using Command Options describes missing feature #4110

EdwardIII opened this issue Aug 8, 2014 · 7 comments
Labels
actionable Clear and specific issues ready for anyone to take them. bug Console good first issue Ideal for your first contribution! (some Symfony experience may be required) hasPR A Pull Request has already been submitted for this issue.

Comments

@EdwardIII
Copy link

This feature seems to be missing/not working as expected:

It is also possible to make an option optionally accept a value (so that --yell or --yell=loud work). Options can also be configured to accept an array of values.

http://symfony.com/doc/current/components/console/introduction.html#using-command-options

While it's true you can specifiy --yell or yell=loud, it looks like you can't meaningfully distinguish between the two:

symfony/symfony#11572

Over on that issue they seem to think it's not really a symfony bug (or not a fixable one) and that maybe it's a documentation bug?

@stof
Copy link
Member

stof commented Aug 8, 2014

It is indeed a documentation bug: the doc does not documents the actual behavior (which cannot change as lots of code is relying on it).

Actually, the sentence here is not wrong. But it does not explain enough what the behavior is.

@weaverryan
Copy link
Member

As I understand it, we cannot "meaningfully distinguish between the two" as @EdwardIII said, and that won't be fixable in the code. So, you can either have -yell, which returns true or false or yell=foo, which returns "foo".

So what should we add/change? Is it that we're not really showing what value will be returned in each case?

@wouterj
Copy link
Member

wouterj commented Dec 13, 2014

Ping, what is missing?

@xabbuh
Copy link
Member

xabbuh commented Dec 13, 2014

@wouterj Someone needs to create a pull request. :)

@wouterj
Copy link
Member

wouterj commented Dec 13, 2014

@xabbuh but to do what? I can't see anything wrong (and I understand that @weaverryan doesn't understand it too)

@xabbuh
Copy link
Member

xabbuh commented Dec 13, 2014

@wouterj The issue is that we currently say that you can create options with optional values. However, if you call a command with such an option without a value, you'll retrieve null as the option's value which is the same when you omit the option. So, how would you distinguish these two cases?

@wouterj
Copy link
Member

wouterj commented Dec 13, 2014

Ah, now I get it. Thanks for clarifying, @xabbuh . Tagging it with actionable and easy pick in that case :)

@wouterj wouterj added Console actionable Clear and specific issues ready for anyone to take them. good first issue Ideal for your first contribution! (some Symfony experience may be required) and removed Console labels Dec 13, 2014
@wouterj wouterj added the hasPR A Pull Request has already been submitted for this issue. label Feb 19, 2015
weaverryan added a commit that referenced this issue Mar 14, 2015
…viereguiluz)

This PR was merged into the 2.3 branch.

Discussion
----------

Reworded the explanation about optional command options

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3+
| Fixed tickets | #4110

Commits
-------

89029cd Reworded again the note about "optional options"
221597a Reworded the explanation about "optional options"
1b5fcf0 Reworded the explanation about optional command options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Clear and specific issues ready for anyone to take them. bug Console good first issue Ideal for your first contribution! (some Symfony experience may be required) hasPR A Pull Request has already been submitted for this issue.
Projects
None yet
Development

No branches or pull requests

5 participants