summaryrefslogtreecommitdiffstats
path: root/Doc/library/argparse.rst
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2020-12-23 17:40:56 (GMT)
committerGitHub <noreply@github.com>2020-12-23 17:40:56 (GMT)
commit41b223d29cdfeb1f222c12c3abaccc3bc128f5e7 (patch)
tree817e48eaad3896b63163931a8fdbf3a03005dad1 /Doc/library/argparse.rst
parentbfda4f5776fd20f92b441c8a88ee7a9d44dc8777 (diff)
downloadcpython-41b223d29cdfeb1f222c12c3abaccc3bc128f5e7.zip
cpython-41b223d29cdfeb1f222c12c3abaccc3bc128f5e7.tar.gz
cpython-41b223d29cdfeb1f222c12c3abaccc3bc128f5e7.tar.bz2
bpo-9694: Fix misleading phrase "optional arguments" (GH-23858)
Diffstat (limited to 'Doc/library/argparse.rst')
-rw-r--r--Doc/library/argparse.rst54
1 files changed, 27 insertions, 27 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 4542961..80e0f01 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -57,7 +57,7 @@ be run at the command line and provides useful help messages:
positional arguments:
N an integer for the accumulator
- optional arguments:
+ options:
-h, --help show this help message and exit
--sum sum the integers (default: find the max)
@@ -217,14 +217,14 @@ The help for this program will display ``myprogram.py`` as the program name
$ python myprogram.py --help
usage: myprogram.py [-h] [--foo FOO]
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo FOO foo help
$ cd ..
$ python subdir/myprogram.py --help
usage: myprogram.py [-h] [--foo FOO]
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo FOO foo help
@@ -235,7 +235,7 @@ To change this default behavior, another value can be supplied using the
>>> parser.print_help()
usage: myprogram [-h]
- optional arguments:
+ options:
-h, --help show this help message and exit
Note that the program name, whether determined from ``sys.argv[0]`` or from the
@@ -249,7 +249,7 @@ specifier.
>>> parser.print_help()
usage: myprogram [-h] [--foo FOO]
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo FOO foo of the myprogram program
@@ -269,7 +269,7 @@ arguments it contains::
positional arguments:
bar bar help
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo [FOO] foo help
@@ -284,7 +284,7 @@ The default message can be overridden with the ``usage=`` keyword argument::
positional arguments:
bar bar help
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo [FOO] foo help
@@ -307,7 +307,7 @@ various arguments::
A foo that bars
- optional arguments:
+ options:
-h, --help show this help message and exit
By default, the description will be line-wrapped so that it fits within the
@@ -329,7 +329,7 @@ argument to :class:`ArgumentParser`::
A foo that bars
- optional arguments:
+ options:
-h, --help show this help message and exit
And that's how you'd foo a bar
@@ -403,7 +403,7 @@ epilog_ texts in command-line help messages::
this description was indented weird but that is okay
- optional arguments:
+ options:
-h, --help show this help message and exit
likewise for this epilog whose whitespace will be cleaned up and whose words
@@ -432,7 +432,7 @@ should not be line-wrapped::
exactly the way
I want it
- optional arguments:
+ options:
-h, --help show this help message and exit
:class:`RawTextHelpFormatter` maintains whitespace for all sorts of help text,
@@ -454,7 +454,7 @@ default values to each of the argument help messages::
positional arguments:
bar BAR! (default: [1, 2, 3])
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo FOO FOO! (default: 42)
@@ -473,7 +473,7 @@ as the regular formatter does)::
positional arguments:
float
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo int
@@ -592,7 +592,7 @@ older arguments with the same option string. To get this behavior, the value
>>> parser.print_help()
usage: PROG [-h] [-f FOO] [--foo FOO]
- optional arguments:
+ options:
-h, --help show this help message and exit
-f FOO old foo help
--foo FOO new foo help
@@ -623,7 +623,7 @@ help will be printed:
$ python myprogram.py --help
usage: myprogram.py [-h] [--foo FOO]
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo FOO foo help
@@ -636,7 +636,7 @@ This can be achieved by passing ``False`` as the ``add_help=`` argument to
>>> parser.print_help()
usage: PROG [--foo FOO]
- optional arguments:
+ options:
--foo FOO foo help
The help option is typically ``-h/--help``. The exception to this is
@@ -649,7 +649,7 @@ the help options::
>>> parser.print_help()
usage: PROG [+h]
- optional arguments:
+ options:
+h, ++help show this help message and exit
@@ -1203,7 +1203,7 @@ argument::
positional arguments:
bar one of the bars to be frobbled
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo foo the bars before frobbling
@@ -1221,7 +1221,7 @@ specifiers include the program name, ``%(prog)s`` and most keyword arguments to
positional arguments:
bar the bar to frobble (default: 42)
- optional arguments:
+ options:
-h, --help show this help message and exit
As the help string supports %-formatting, if you want a literal ``%`` to appear
@@ -1235,7 +1235,7 @@ setting the ``help`` value to ``argparse.SUPPRESS``::
>>> parser.print_help()
usage: frobble [-h]
- optional arguments:
+ options:
-h, --help show this help message and exit
@@ -1262,7 +1262,7 @@ will be referred to as ``FOO``. An example::
positional arguments:
bar
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo FOO
@@ -1279,7 +1279,7 @@ An alternative name can be specified with ``metavar``::
positional arguments:
XXX
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo YYY
@@ -1297,7 +1297,7 @@ arguments::
>>> parser.print_help()
usage: PROG [-h] [-x X X] [--foo bar baz]
- optional arguments:
+ options:
-h, --help show this help message and exit
-x X X
--foo bar baz
@@ -1701,7 +1701,7 @@ Sub-commands
a a help
b b help
- optional arguments:
+ options:
-h, --help show this help message and exit
--foo foo help
@@ -1711,13 +1711,13 @@ Sub-commands
positional arguments:
bar bar help
- optional arguments:
+ options:
-h, --help show this help message and exit
>>> parser.parse_args(['b', '--help'])
usage: PROG b [-h] [--baz {X,Y,Z}]
- optional arguments:
+ options:
-h, --help show this help message and exit
--baz {X,Y,Z} baz help
@@ -1734,7 +1734,7 @@ Sub-commands
>>> parser.parse_args(['-h'])
usage: [-h] {foo,bar} ...
- optional arguments:
+ options:
-h, --help show this help message and exit
subcommands: