Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 19d4322

Browse files
committed
minor #5820 Fixed an issue with command option shortcuts (javiereguiluz)
This PR was squashed before being merged into the 2.3 branch (closes #5820). Discussion ---------- Fixed an issue with command option shortcuts | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | - I can't reproduce the behavior explained in this article. That's why I think this is an error. When I execute the command as `-b=Hello`, the value returned by `$input->getOption('bar')` is `=Hello` instead of `Hello`. Commits ------- aad2fa4 Fixed an issue with command option shortcuts
2 parents e8c5c51 + aad2fa4 commit 19d4322

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

components/console/console_arguments.rst

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ is required. It can be separated from the option name either by spaces or
4949
except that it doesn't require a value. Have a look at the following table
5050
to get an overview of the possible ways to pass options:
5151

52-
===================== ========= =========== ============
53-
Input ``foo`` ``bar`` ``cat``
54-
===================== ========= =========== ============
55-
``--bar=Hello`` ``false`` ``"Hello"`` ``null``
56-
``--bar Hello`` ``false`` ``"Hello"`` ``null``
57-
``-b=Hello`` ``false`` ``"Hello"`` ``null``
58-
``-b Hello`` ``false`` ``"Hello"`` ``null``
59-
``-bHello`` ``false`` ``"Hello"`` ``null``
60-
``-fcWorld -b Hello`` ``true`` ``"Hello"`` ``"World"``
61-
``-cfWorld -b Hello`` ``false`` ``"Hello"`` ``"fWorld"``
62-
``-cbWorld`` ``false`` ``null`` ``"bWorld"``
63-
===================== ========= =========== ============
52+
===================== ========= ============ ============
53+
Input ``foo`` ``bar`` ``cat``
54+
===================== ========= ============ ============
55+
``--bar=Hello`` ``false`` ``"Hello"`` ``null``
56+
``--bar Hello`` ``false`` ``"Hello"`` ``null``
57+
``-b=Hello`` ``false`` ``"=Hello"`` ``null``
58+
``-b Hello`` ``false`` ``"Hello"`` ``null``
59+
``-bHello`` ``false`` ``"Hello"`` ``null``
60+
``-fcWorld -b Hello`` ``true`` ``"Hello"`` ``"World"``
61+
``-cfWorld -b Hello`` ``false`` ``"Hello"`` ``"fWorld"``
62+
``-cbWorld`` ``false`` ``null`` ``"bWorld"``
63+
===================== ========= ============ ============
6464

6565
Things get a little bit more tricky when the command also accepts an optional
6666
argument::
@@ -77,15 +77,15 @@ arguments. Have a look at the fifth example in the following table where it
7777
is used to tell the command that ``World`` is the value for ``arg`` and not
7878
the value of the optional ``cat`` option:
7979

80-
============================== ================= =========== ===========
81-
Input ``bar`` ``cat`` ``arg``
82-
============================== ================= =========== ===========
83-
``--bar Hello`` ``"Hello"`` ``null`` ``null``
84-
``--bar Hello World`` ``"Hello"`` ``null`` ``"World"``
85-
``--bar "Hello World"`` ``"Hello World"`` ``null`` ``null``
86-
``--bar Hello --cat World`` ``"Hello"`` ``"World"`` ``null``
87-
``--bar Hello --cat -- World`` ``"Hello"`` ``null`` ``"World"``
88-
``-b Hello -c World`` ``"Hello"`` ``"World"`` ``null``
89-
============================== ================= =========== ===========
80+
============================== ================= =========== ===========
81+
Input ``bar`` ``cat`` ``arg``
82+
============================== ================= =========== ===========
83+
``--bar Hello`` ``"Hello"`` ``null`` ``null``
84+
``--bar Hello World`` ``"Hello"`` ``null`` ``"World"``
85+
``--bar "Hello World"`` ``"Hello World"`` ``null`` ``null``
86+
``--bar Hello --cat World`` ``"Hello"`` ``"World"`` ``null``
87+
``--bar Hello --cat -- World`` ``"Hello"`` ``null`` ``"World"``
88+
``-b Hello -c World`` ``"Hello"`` ``"World"`` ``null``
89+
============================== ================= =========== ===========
9090

9191
.. _docopt: http://docopt.org/

0 commit comments

Comments
 (0)