-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Reworded the explanation about optional command options #5009
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -296,9 +296,11 @@ declare a one-letter shortcut that you can call with a single dash like | |
|
||
.. tip:: | ||
|
||
It is also possible to make an option *optionally* accept a value (so that | ||
``--yell``, ``--yell=loud`` or ``--yell loud`` work). Options can also be configured to | ||
accept an array of values. | ||
There is nothing forbidding you to create a command with an *optional option*, | ||
which is an input option set to ``InputOption::OPTIONAL`` mode. You will just | ||
not be able to distinguish when the flag for that option was used without a | ||
value (``command --yell``) or when it was not used at all (``command``). | ||
In both cases the value retrieved for the option will be the same ``null``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me try again :)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 (but with "without a value") There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your suggestions. It's much better now. |
||
|
||
For example, add a new option to the command that can be used to specify | ||
how many times in a row the message should be printed:: | ||
|
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.
-1 on the term "optional option", options are always optional. It's the value we are talking about here