bpo-9694: Fix misleading phrase "optional arguments" (GH-23858) · python/cpython@41b223d (original) (raw)
`@@ -57,7 +57,7 @@ be run at the command line and provides useful help messages:
`
57
57
` positional arguments:
`
58
58
` N an integer for the accumulator
`
59
59
``
60
``
`-
optional arguments:
`
``
60
`+
options:
`
61
61
` -h, --help show this help message and exit
`
62
62
` --sum sum the integers (default: find the max)
`
63
63
``
``` @@ -217,14 +217,14 @@ The help for this program will display myprogram.py
as the program name
`217`
`217`
` $ python myprogram.py --help
`
`218`
`218`
` usage: myprogram.py [-h] [--foo FOO]
`
`219`
`219`
``
`220`
``
`-
optional arguments:
`
``
`220`
`+
options:
`
`221`
`221`
` -h, --help show this help message and exit
`
`222`
`222`
` --foo FOO foo help
`
`223`
`223`
` $ cd ..
`
`224`
`224`
` $ python subdir/myprogram.py --help
`
`225`
`225`
` usage: myprogram.py [-h] [--foo FOO]
`
`226`
`226`
``
`227`
``
`-
optional arguments:
`
``
`227`
`+
options:
`
`228`
`228`
` -h, --help show this help message and exit
`
`229`
`229`
` --foo FOO foo help
`
`230`
`230`
``
`@@ -235,7 +235,7 @@ To change this default behavior, another value can be supplied using the
`
`235`
`235`
` >>> parser.print_help()
`
`236`
`236`
` usage: myprogram [-h]
`
`237`
`237`
``
`238`
``
`-
optional arguments:
`
``
`238`
`+
options:
`
`239`
`239`
` -h, --help show this help message and exit
`
`240`
`240`
``
`241`
`241`
``` Note that the program name, whether determined from ``sys.argv[0]`` or from the
`@@ -249,7 +249,7 @@ specifier.
`
249
249
` >>> parser.print_help()
`
250
250
` usage: myprogram [-h] [--foo FOO]
`
251
251
``
252
``
`-
optional arguments:
`
``
252
`+
options:
`
253
253
` -h, --help show this help message and exit
`
254
254
` --foo FOO foo of the myprogram program
`
255
255
``
`@@ -269,7 +269,7 @@ arguments it contains::
`
269
269
` positional arguments:
`
270
270
` bar bar help
`
271
271
``
272
``
`-
optional arguments:
`
``
272
`+
options:
`
273
273
` -h, --help show this help message and exit
`
274
274
` --foo [FOO] foo help
`
275
275
``
``` @@ -284,7 +284,7 @@ The default message can be overridden with the usage=
keyword argument::
`284`
`284`
` positional arguments:
`
`285`
`285`
` bar bar help
`
`286`
`286`
``
`287`
``
`-
optional arguments:
`
``
`287`
`+
options:
`
`288`
`288`
` -h, --help show this help message and exit
`
`289`
`289`
` --foo [FOO] foo help
`
`290`
`290`
``
`@@ -307,7 +307,7 @@ various arguments::
`
`307`
`307`
``
`308`
`308`
` A foo that bars
`
`309`
`309`
``
`310`
``
`-
optional arguments:
`
``
`310`
`+
options:
`
`311`
`311`
` -h, --help show this help message and exit
`
`312`
`312`
``
`313`
`313`
`By default, the description will be line-wrapped so that it fits within the
`
`` @@ -329,7 +329,7 @@ argument to :class:`ArgumentParser`::
``
`329`
`329`
``
`330`
`330`
` A foo that bars
`
`331`
`331`
``
`332`
``
`-
optional arguments:
`
``
`332`
`+
options:
`
`333`
`333`
` -h, --help show this help message and exit
`
`334`
`334`
``
`335`
`335`
` And that's how you'd foo a bar
`
`@@ -403,7 +403,7 @@ epilog_ texts in command-line help messages::
`
`403`
`403`
``
`404`
`404`
` this description was indented weird but that is okay
`
`405`
`405`
``
`406`
``
`-
optional arguments:
`
``
`406`
`+
options:
`
`407`
`407`
` -h, --help show this help message and exit
`
`408`
`408`
``
`409`
`409`
` likewise for this epilog whose whitespace will be cleaned up and whose words
`
`@@ -432,7 +432,7 @@ should not be line-wrapped::
`
`432`
`432`
` exactly the way
`
`433`
`433`
` I want it
`
`434`
`434`
``
`435`
``
`-
optional arguments:
`
``
`435`
`+
options:
`
`436`
`436`
` -h, --help show this help message and exit
`
`437`
`437`
``
`438`
`438`
`` :class:`RawTextHelpFormatter` maintains whitespace for all sorts of help text,
``
`@@ -454,7 +454,7 @@ default values to each of the argument help messages::
`
`454`
`454`
` positional arguments:
`
`455`
`455`
` bar BAR! (default: [1, 2, 3])
`
`456`
`456`
``
`457`
``
`-
optional arguments:
`
``
`457`
`+
options:
`
`458`
`458`
` -h, --help show this help message and exit
`
`459`
`459`
` --foo FOO FOO! (default: 42)
`
`460`
`460`
``
`@@ -473,7 +473,7 @@ as the regular formatter does)::
`
`473`
`473`
` positional arguments:
`
`474`
`474`
` float
`
`475`
`475`
``
`476`
``
`-
optional arguments:
`
``
`476`
`+
options:
`
`477`
`477`
` -h, --help show this help message and exit
`
`478`
`478`
` --foo int
`
`479`
`479`
``
`@@ -592,7 +592,7 @@ older arguments with the same option string. To get this behavior, the value
`
`592`
`592`
` >>> parser.print_help()
`
`593`
`593`
` usage: PROG [-h] [-f FOO] [--foo FOO]
`
`594`
`594`
``
`595`
``
`-
optional arguments:
`
``
`595`
`+
options:
`
`596`
`596`
` -h, --help show this help message and exit
`
`597`
`597`
` -f FOO old foo help
`
`598`
`598`
` --foo FOO new foo help
`
`@@ -623,7 +623,7 @@ help will be printed:
`
`623`
`623`
` $ python myprogram.py --help
`
`624`
`624`
` usage: myprogram.py [-h] [--foo FOO]
`
`625`
`625`
``
`626`
``
`-
optional arguments:
`
``
`626`
`+
options:
`
`627`
`627`
` -h, --help show this help message and exit
`
`628`
`628`
` --foo FOO foo help
`
`629`
`629`
``
``` @@ -636,7 +636,7 @@ This can be achieved by passing ``False`` as the ``add_help=`` argument to
636
636
` >>> parser.print_help()
`
637
637
` usage: PROG [--foo FOO]
`
638
638
``
639
``
`-
optional arguments:
`
``
639
`+
options:
`
640
640
` --foo FOO foo help
`
641
641
``
642
642
``` The help option is typically -h/--help
. The exception to this is
`@@ -649,7 +649,7 @@ the help options::
`
`649`
`649`
` >>> parser.print_help()
`
`650`
`650`
` usage: PROG [+h]
`
`651`
`651`
``
`652`
``
`-
optional arguments:
`
``
`652`
`+
options:
`
`653`
`653`
` +h, ++help show this help message and exit
`
`654`
`654`
``
`655`
`655`
``
`@@ -1203,7 +1203,7 @@ argument::
`
`1203`
`1203`
` positional arguments:
`
`1204`
`1204`
` bar one of the bars to be frobbled
`
`1205`
`1205`
``
`1206`
``
`-
optional arguments:
`
``
`1206`
`+
options:
`
`1207`
`1207`
` -h, --help show this help message and exit
`
`1208`
`1208`
` --foo foo the bars before frobbling
`
`1209`
`1209`
``
``` @@ -1221,7 +1221,7 @@ specifiers include the program name, ``%(prog)s`` and most keyword arguments to
1221
1221
` positional arguments:
`
1222
1222
` bar the bar to frobble (default: 42)
`
1223
1223
``
1224
``
`-
optional arguments:
`
``
1224
`+
options:
`
1225
1225
` -h, --help show this help message and exit
`
1226
1226
``
1227
1227
``` As the help string supports %-formatting, if you want a literal %
to appear
``` @@ -1235,7 +1235,7 @@ setting the ``help`` value to ``argparse.SUPPRESS``::
1235
1235
` >>> parser.print_help()
`
1236
1236
` usage: frobble [-h]
`
1237
1237
``
1238
``
`-
optional arguments:
`
``
1238
`+
options:
`
1239
1239
` -h, --help show this help message and exit
`
1240
1240
``
1241
1241
``
``` @@ -1262,7 +1262,7 @@ will be referred to as FOO
. An example::
`1262`
`1262`
` positional arguments:
`
`1263`
`1263`
` bar
`
`1264`
`1264`
``
`1265`
``
`-
optional arguments:
`
``
`1265`
`+
options:
`
`1266`
`1266`
` -h, --help show this help message and exit
`
`1267`
`1267`
` --foo FOO
`
`1268`
`1268`
``
``` @@ -1279,7 +1279,7 @@ An alternative name can be specified with ``metavar``::
1279
1279
` positional arguments:
`
1280
1280
` XXX
`
1281
1281
``
1282
``
`-
optional arguments:
`
``
1282
`+
options:
`
1283
1283
` -h, --help show this help message and exit
`
1284
1284
` --foo YYY
`
1285
1285
``
`@@ -1297,7 +1297,7 @@ arguments::
`
1297
1297
` >>> parser.print_help()
`
1298
1298
` usage: PROG [-h] [-x X X] [--foo bar baz]
`
1299
1299
``
1300
``
`-
optional arguments:
`
``
1300
`+
options:
`
1301
1301
` -h, --help show this help message and exit
`
1302
1302
` -x X X
`
1303
1303
` --foo bar baz
`
`@@ -1701,7 +1701,7 @@ Sub-commands
`
1701
1701
` a a help
`
1702
1702
` b b help
`
1703
1703
``
1704
``
`-
optional arguments:
`
``
1704
`+
options:
`
1705
1705
` -h, --help show this help message and exit
`
1706
1706
` --foo foo help
`
1707
1707
``
`@@ -1711,13 +1711,13 @@ Sub-commands
`
1711
1711
` positional arguments:
`
1712
1712
` bar bar help
`
1713
1713
``
1714
``
`-
optional arguments:
`
``
1714
`+
options:
`
1715
1715
` -h, --help show this help message and exit
`
1716
1716
``
1717
1717
` >>> parser.parse_args(['b', '--help'])
`
1718
1718
` usage: PROG b [-h] [--baz {X,Y,Z}]
`
1719
1719
``
1720
``
`-
optional arguments:
`
``
1720
`+
options:
`
1721
1721
` -h, --help show this help message and exit
`
1722
1722
` --baz {X,Y,Z} baz help
`
1723
1723
``
`@@ -1734,7 +1734,7 @@ Sub-commands
`
1734
1734
` >>> parser.parse_args(['-h'])
`
1735
1735
` usage: [-h] {foo,bar} ...
`
1736
1736
``
1737
``
`-
optional arguments:
`
``
1737
`+
options:
`
1738
1738
` -h, --help show this help message and exit
`
1739
1739
``
1740
1740
` subcommands:
`