Skip to content

Commit 8105672

Browse files
committed
Documentation: Replace "-h" for help with "-?"
1 parent d816f0e commit 8105672

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

docs/index.rst

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ To get a list of available commands and their descriptions, just run with no com
111111

112112
To get help text for a particular command::
113113

114-
python manage.py runserver -h
114+
python manage.py runserver -?
115115

116116
This will print usage plus the docstring of the ``Command``.
117117

@@ -128,9 +128,9 @@ Commands created this way are run in exactly the same way as those created with
128128
python manage.py hello
129129
> hello
130130

131-
As with the ``Command`` class, the docstring you use for the function will appear when you run with the **-h** option::
131+
As with the ``Command`` class, the docstring you use for the function will appear when you run with the **-?** or **--help** option::
132132

133-
python manage.py -h
133+
python manage.py -?
134134
> Just say hello
135135

136136
Finally, the ``@option`` decorator, again belonging to ``Manager`` can be used when you want more sophisticated
@@ -142,6 +142,12 @@ control over your commands::
142142

143143
The ``@option`` decorator is explained in more detail below.
144144

145+
*New in version 2.0*
146+
147+
Help was previously available with **--help** and **-h**. This had a couple
148+
of less-than-ideal consequences, among them the inability to use **-h** as
149+
a shortcut for **--host**. If you want to restore the original meaning of
150+
**-h**,
145151

146152
Adding arguments to commands
147153
----------------------------
@@ -216,12 +222,10 @@ alternatively::
216222
> python manage.py hello -n Joe
217223
hello Joe
218224

219-
There are a couple of important points to note here.
220-
221-
The short-form **-n** is formed from the first letter of the argument, so "name" > "-n". Therefore it's a good idea that your
222-
optional argument variable names begin with different letters.
225+
The short-form **-n** is formed from the first letter of the argument, so "name" > "-n". Therefore it's a good idea for your
226+
optional argument variable names to begin with different letters.
223227

224-
The second issue is that the **-h** switch always runs the help text for that command, so avoid arguments starting with the letter "h".
228+
*New in version 2.0*
225229

226230
Note also that if your optional argument is a boolean, for example::
227231

@@ -341,10 +345,16 @@ argument parser.
341345
In order for manager options to work you must pass a factory function, rather than a Flask instance, to your
342346
``Manager`` constructor. A simple but complete example is available in `this gist <https://gist.github.com/smurfix/9307618>`_.
343347

344-
*New in version 0.7.0.*
348+
*New in version 2.0*
349+
350+
Before version 2, options and command names could be interspersed freely.
351+
The author decided to discontinue this practice for a number of reasons;
352+
the problem with the most impact was that it was not possible to do
353+
354+
> python manage.py connect -d DEST
355+
> python manage.py import -d DIR
345356

346-
Before version 0.7, options and command names could be interspersed freely.
347-
This is no longer possible.
357+
as these options collided.
348358

349359
Getting user input
350360
------------------
@@ -366,8 +376,8 @@ Getting user input
366376

367377
It then runs like this::
368378

369-
python manage.py dropdb
370-
> Are you sure you want to lose all your data ? [N]
379+
> python manage.py dropdb
380+
Are you sure you want to lose all your data ? [N]
371381

372382
See the :ref:`api` below for details on the various prompt functions.
373383

@@ -391,7 +401,7 @@ and then run the command::
391401

392402
python manage.py runserver
393403

394-
The ``Server`` command has a number of command-line arguments - run ``python manage.py runserver -h`` for details on these. You can redefine the defaults in the constructor::
404+
The ``Server`` command has a number of command-line arguments - run ``python manage.py runserver -?`` for details on these. You can redefine the defaults in the constructor::
395405

396406
server = Server(host="0.0.0.0", port=9000)
397407

0 commit comments

Comments
 (0)