mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-27 18:42:20 +00:00
Update order of help option in docs
This commit is contained in:
@@ -64,7 +64,7 @@ $ lua script.lua foo bar
|
||||
```
|
||||
|
||||
```
|
||||
Usage: script [-o <output>] [-I <include>] [-h] <input>
|
||||
Usage: script [-h] [-o <output>] [-I <include>] <input>
|
||||
|
||||
Error: too many arguments
|
||||
```
|
||||
@@ -74,7 +74,7 @@ $ lua script.lua --help
|
||||
```
|
||||
|
||||
```
|
||||
Usage: script [-o <output>] [-I <include>] [-h] <input>
|
||||
Usage: script [-h] [-o <output>] [-I <include>] <input>
|
||||
|
||||
An example.
|
||||
|
||||
@@ -82,11 +82,11 @@ Arguments:
|
||||
input Input file.
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit.
|
||||
-o <output>, --output <output>
|
||||
Output file. (default: a.out)
|
||||
-I <include>, --include <include>
|
||||
Include locations.
|
||||
-h, --help Show this help message and exit.
|
||||
```
|
||||
|
||||
```bash
|
||||
@@ -94,7 +94,7 @@ $ lua script.lua foo --outptu=bar
|
||||
```
|
||||
|
||||
```
|
||||
Usage: script [-o <output>] [-I <include>] [-h] <input>
|
||||
Usage: script [-h] [-o <output>] [-I <include>] <input>
|
||||
|
||||
Error: unknown option '--outptu'
|
||||
Did you mean '--output'?
|
||||
|
@@ -31,7 +31,7 @@ argparse can perform automatic validation and conversion on arguments. If ``conv
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-t <times>] [-h] <input>
|
||||
Usage: script.lua [-h] [-t <times>] <input>
|
||||
|
||||
Error: nonexistent.txt: No such file or directory
|
||||
|
||||
@@ -41,7 +41,7 @@ argparse can perform automatic validation and conversion on arguments. If ``conv
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-t <times>] [-h] <input>
|
||||
Usage: script.lua [-h] [-t <times>] <input>
|
||||
|
||||
Error: malformed argument 'many'
|
||||
|
||||
|
@@ -91,7 +91,7 @@ Commands have their own usage and help messages.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua install [-f <from>] [-h] <rock>
|
||||
Usage: script.lua install [-h] [-f <from>] <rock>
|
||||
|
||||
Error: too few arguments
|
||||
|
||||
@@ -101,14 +101,14 @@ Commands have their own usage and help messages.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua install [-f <from>] [-h] <rock>
|
||||
Usage: script.lua install [-h] [-f <from>] <rock>
|
||||
|
||||
Arguments:
|
||||
rock
|
||||
|
||||
Options:
|
||||
-f <from>, --from <from>
|
||||
-h, --help Show this help message and exit.
|
||||
-f <from>, --from <from>
|
||||
|
||||
Making a command optional
|
||||
-------------------------
|
||||
|
@@ -30,12 +30,12 @@ The existence of a default value is reflected in help message, unless ``show_def
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-o <output>] [-h]
|
||||
Usage: script.lua [-h] [-o <output>]
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit.
|
||||
-o <output>, --output <output>
|
||||
Output file. (default: a.out)
|
||||
-h, --help Show this help message and exit.
|
||||
|
||||
Note that invocation without required arguments is still an error.
|
||||
|
||||
@@ -45,7 +45,7 @@ Note that invocation without required arguments is still an error.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-o <output>] [-h]
|
||||
Usage: script.lua [-h] [-o <output>]
|
||||
|
||||
Error: too few arguments
|
||||
|
||||
@@ -76,12 +76,12 @@ Consider the difference:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-o <o>] [-p [<p>]] [-h]
|
||||
Usage: script.lua [-h] [-o <o>] [-p [<p>]]
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit.
|
||||
-o <o> default: a.out
|
||||
-p [<p>] default: password
|
||||
-h, --help Show this help message and exit.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
@@ -111,6 +111,6 @@ Consider the difference:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-o <o>] [-p [<p>]] [-h]
|
||||
Usage: script.lua [-h] [-o <o>] [-p [<p>]]
|
||||
|
||||
Error: too few arguments
|
||||
|
@@ -23,11 +23,11 @@ it is not included into help and usage messages, but otherwise works normally.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [--normal-option <normal_option>] [-h]
|
||||
Usage: script.lua [-h] [--normal-option <normal_option>]
|
||||
|
||||
Options:
|
||||
--normal-option <normal_option>
|
||||
-h, --help Show this help message and exit.
|
||||
--normal-option <normal_option>
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
@@ -57,11 +57,11 @@ For options and arguments, ``argname`` property controls the placeholder for the
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-f <server>] [-h]
|
||||
Usage: script.lua [-h] [-f <server>]
|
||||
|
||||
Options:
|
||||
-f <server>, --from <server>
|
||||
-h, --help Show this help message and exit.
|
||||
-f <server>, --from <server>
|
||||
|
||||
``argname`` can be an array of placeholders.
|
||||
|
||||
@@ -78,11 +78,11 @@ For options and arguments, ``argname`` property controls the placeholder for the
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [--pair <key> <value>] [-h]
|
||||
Usage: script.lua [-h] [--pair <key> <value>]
|
||||
|
||||
Options:
|
||||
--pair <key> <value>
|
||||
-h, --help Show this help message and exit.
|
||||
--pair <key> <value>
|
||||
|
||||
Grouping elements
|
||||
-----------------
|
||||
@@ -113,9 +113,9 @@ a named group with its own section in the help message. Elements outside any gro
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-v] [--use-colors] [--encoding <encoding>]
|
||||
Usage: script.lua [-h] [-v] [--use-colors] [--encoding <encoding>]
|
||||
[--compression-level <compression_level>]
|
||||
[--skip-broken-chunks] [--version] [-h]
|
||||
[--skip-broken-chunks] [--version]
|
||||
|
||||
Configuring output format:
|
||||
-v, --verbose
|
||||
@@ -127,8 +127,8 @@ a named group with its own section in the help message. Elements outside any gro
|
||||
--skip-broken-chunks
|
||||
|
||||
Other options:
|
||||
--version
|
||||
-h, --help Show this help message and exit.
|
||||
--version
|
||||
|
||||
Help message line wrapping
|
||||
--------------------------
|
||||
@@ -167,9 +167,10 @@ and the continuation lines are aligned with the first word after the list item m
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-f <foo>] [-b <bar>] [-h]
|
||||
Usage: script.lua [-h] [-f <foo>] [-b <bar>]
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit.
|
||||
-f <foo>, Lorem ipsum dolor sit amet, consectetur adipiscing
|
||||
--foo <foo> elit, sed do eiusmod tempor incididunt ut labore et
|
||||
dolore magna aliqua. Ut enim ad minim veniam, quis
|
||||
@@ -188,7 +189,6 @@ and the continuation lines are aligned with the first word after the list item m
|
||||
ullamco laboris nisi ut aliquip...
|
||||
* Duis aute irure dolor in reprehenderit in voluptate
|
||||
velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
-h, --help Show this help message and exit.
|
||||
|
||||
``help_max_width`` property is inherited by commands.
|
||||
|
||||
@@ -221,8 +221,8 @@ Like ``help_max_width``, all of them are inherited by commands when set on the p
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [--foo <foo>] [--bar <bar>]
|
||||
[--baz <baz>] [--qux <qux>] [-h]
|
||||
Usage: script.lua [-h] [--foo <foo>] [--bar <bar>]
|
||||
[--baz <baz>] [--qux <qux>]
|
||||
|
||||
Help message for a group of arguments, options, or commands is organized into two columns, with usage
|
||||
template on the left side and descriptions on the right side.
|
||||
@@ -250,11 +250,13 @@ within a group (``0`` by default).
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [--foo <foo>] [--bar <bar>] [--baz <baz>]
|
||||
[--qux <qux>] [-h]
|
||||
Usage: script.lua [-h] [--foo <foo>] [--bar <bar>] [--baz <baz>]
|
||||
[--qux <qux>]
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help Show this help message and exit.
|
||||
|
||||
--foo <foo> Set foo.
|
||||
|
||||
--bar <bar> Set bar.
|
||||
@@ -262,5 +264,3 @@ within a group (``0`` by default).
|
||||
--baz <baz> Set baz.
|
||||
|
||||
--qux <qux> Set qux.
|
||||
|
||||
-h, --help Show this help message and exit.
|
||||
|
@@ -127,7 +127,7 @@ Set ``overwrite`` property to ``false`` to prohibit this behavior.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Usage: script.lua [-o <output>] [-h]
|
||||
Usage: script.lua [-h] [-o <output>]
|
||||
|
||||
Error: option '-o' must be used at most 1 time
|
||||
|
||||
|
Reference in New Issue
Block a user