From 1b5fcf0a524f433abc7651ab7243a23ec9bfddcd Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 18 Feb 2015 17:20:59 +0100 Subject: [PATCH 1/3] Reworded the explanation about optional command options --- components/console/introduction.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index a57068990fa..8b678518008 100644 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -296,9 +296,12 @@ 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. + It may look that it's possible to make an option *optionally* accept a value + (so that ``--yell`` or ``--yell=loud`` work). However, if you call a command + with an option without a value, you'll retrieve ``null`` as the option's value + which is the same when you omit the option. In practice, this means that a + command cannot distinguish between passing an option without a value and not + passing that very same option. 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:: From 221597a48634b907bb97bec18dcaa9afcf90875b Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 20 Feb 2015 08:46:13 +0100 Subject: [PATCH 2/3] Reworded the explanation about "optional options" --- components/console/introduction.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 8b678518008..905b6478594 100644 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -296,12 +296,11 @@ declare a one-letter shortcut that you can call with a single dash like .. tip:: - It may look that it's possible to make an option *optionally* accept a value - (so that ``--yell`` or ``--yell=loud`` work). However, if you call a command - with an option without a value, you'll retrieve ``null`` as the option's value - which is the same when you omit the option. In practice, this means that a - command cannot distinguish between passing an option without a value and not - passing that very same option. + 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``. 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:: From 89029cd3a27b19982a391861b7cf04285efd18fd Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 20 Feb 2015 11:56:02 +0100 Subject: [PATCH 3/3] Reworded again the note about "optional options" --- components/console/introduction.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 905b6478594..15cc4e695dc 100644 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -296,11 +296,11 @@ declare a one-letter shortcut that you can call with a single dash like .. tip:: - 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 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 --yell``) or when it + wasn't used at all (``command``). In both cases, the value retrieved for + the option will be ``null``. 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::