Skip to content

Commit 1d827ff

Browse files
committed
Consistency fix: "command line" is the noun, "command-line" the adjective.
1 parent ab8d93c commit 1d827ff

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Doc/library/argparse.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
:mod:`argparse` --- Parser for command line options, arguments and sub-commands
1+
:mod:`argparse` --- Parser for command-line options, arguments and sub-commands
22
===============================================================================
33

44
.. module:: argparse
@@ -108,10 +108,10 @@ Parsing arguments
108108
^^^^^^^^^^^^^^^^^
109109

110110
:class:`ArgumentParser` parses args through the
111-
:meth:`~ArgumentParser.parse_args` method. This will inspect the command-line,
111+
:meth:`~ArgumentParser.parse_args` method. This will inspect the command line,
112112
convert each arg to the appropriate type and then invoke the appropriate action.
113113
In most cases, this means a simple namespace object will be built up from
114-
attributes parsed out of the command-line::
114+
attributes parsed out of the command line::
115115

116116
>>> parser.parse_args(['--sum', '7', '-1', '42'])
117117
Namespace(accumulate=<built-in function sum>, integers=[7, -1, 42])
@@ -221,7 +221,7 @@ the parser's help message. For example, consider a file named
221221
parser.add_argument('--foo', help='foo help')
222222
args = parser.parse_args()
223223

224-
If ``-h`` or ``--help`` is supplied at the command-line, the ArgumentParser
224+
If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser
225225
help will be printed::
226226

227227
$ python myprogram.py --help
@@ -578,21 +578,21 @@ The add_argument() method
578578
[const], [default], [type], [choices], [required], \
579579
[help], [metavar], [dest])
580580

581-
Define how a single command line argument should be parsed. Each parameter
581+
Define how a single command-line argument should be parsed. Each parameter
582582
has its own more detailed description below, but in short they are:
583583

584584
* `name or flags`_ - Either a name or a list of option strings, e.g. ``foo``
585585
or ``-f, --foo``
586586

587587
* action_ - The basic type of action to be taken when this argument is
588-
encountered at the command-line.
588+
encountered at the command line.
589589

590590
* nargs_ - The number of command-line arguments that should be consumed.
591591

592592
* const_ - A constant value required by some action_ and nargs_ selections.
593593

594594
* default_ - The value produced if the argument is absent from the
595-
command-line.
595+
command line.
596596

597597
* type_ - The type to which the command-line arg should be converted.
598598

@@ -752,7 +752,7 @@ single action to be taken. The ``nargs`` keyword argument associates a
752752
different number of command-line arguments with a single action.. The supported
753753
values are:
754754

755-
* N (an integer). N args from the command-line will be gathered together into a
755+
* N (an integer). N args from the command line will be gathered together into a
756756
list. For example::
757757

758758
>>> parser = argparse.ArgumentParser()
@@ -764,7 +764,7 @@ values are:
764764
Note that ``nargs=1`` produces a list of one item. This is different from
765765
the default, in which the item is produced by itself.
766766

767-
* ``'?'``. One arg will be consumed from the command-line if possible, and
767+
* ``'?'``. One arg will be consumed from the command line if possible, and
768768
produced as a single item. If no command-line arg is present, the value from
769769
default_ will be produced. Note that for optional arguments, there is an
770770
additional case - the option string is present but not followed by a
@@ -839,7 +839,7 @@ ArgumentParser actions. The two most common uses of it are:
839839

840840
* When :meth:`add_argument` is called with option strings (like ``-f`` or
841841
``--foo``) and ``nargs='?'``. This creates an optional argument that can be
842-
followed by zero or one command-line args. When parsing the command-line, if
842+
followed by zero or one command-line args. When parsing the command line, if
843843
the option string is encountered with no command-line arg following it, the
844844
value of ``const`` will be assumed instead. See the nargs_ description for
845845
examples.
@@ -851,7 +851,7 @@ default
851851
^^^^^^^
852852

853853
All optional arguments and some positional arguments may be omitted at the
854-
command-line. The ``default`` keyword argument of :meth:`add_argument`, whose
854+
command line. The ``default`` keyword argument of :meth:`add_argument`, whose
855855
value defaults to ``None``, specifies what value should be used if the
856856
command-line arg is not present. For optional arguments, the ``default`` value
857857
is used when the option string was not present at the command line::
@@ -949,7 +949,7 @@ choices
949949

950950
Some command-line args should be selected from a restricted set of values.
951951
These can be handled by passing a container object as the ``choices`` keyword
952-
argument to :meth:`add_argument`. When the command-line is parsed, arg values
952+
argument to :meth:`add_argument`. When the command line is parsed, arg values
953953
will be checked, and an error message will be displayed if the arg was not one
954954
of the acceptable values::
955955

@@ -982,7 +982,7 @@ required
982982
^^^^^^^^
983983

984984
In general, the argparse module assumes that flags like ``-f`` and ``--bar``
985-
indicate *optional* arguments, which can always be omitted at the command-line.
985+
indicate *optional* arguments, which can always be omitted at the command line.
986986
To make an option *required*, ``True`` can be specified for the ``required=``
987987
keyword argument to :meth:`add_argument`::
988988

@@ -1008,7 +1008,7 @@ help
10081008

10091009
The ``help`` value is a string containing a brief description of the argument.
10101010
When a user requests help (usually by using ``-h`` or ``--help`` at the
1011-
command-line), these ``help`` descriptions will be displayed with each
1011+
command line), these ``help`` descriptions will be displayed with each
10121012
argument::
10131013

10141014
>>> parser = argparse.ArgumentParser(prog='frobble')
@@ -1179,7 +1179,7 @@ passed as two separate arguments::
11791179
Namespace(foo='FOO', x=None)
11801180

11811181
For long options (options with names longer than a single character), the option
1182-
and value can also be passed as a single command line argument, using ``=`` to
1182+
and value can also be passed as a single command-line argument, using ``=`` to
11831183
separate them::
11841184

11851185
>>> parser.parse_args('--foo=FOO'.split())
@@ -1205,7 +1205,7 @@ as long as only the last option (or none of them) requires a value::
12051205
Invalid arguments
12061206
^^^^^^^^^^^^^^^^^
12071207

1208-
While parsing the command-line, ``parse_args`` checks for a variety of errors,
1208+
While parsing the command line, ``parse_args`` checks for a variety of errors,
12091209
including ambiguous options, invalid types, invalid options, wrong number of
12101210
positional arguments, etc. When it encounters such an error, it exits and
12111211
prints the error along with a usage message::
@@ -1641,7 +1641,7 @@ Parser defaults
16411641
Most of the time, the attributes of the object returned by :meth:`parse_args`
16421642
will be fully determined by inspecting the command-line args and the argument
16431643
actions. :meth:`ArgumentParser.set_defaults` allows some additional
1644-
attributes that are determined without any inspection of the command-line to
1644+
attributes that are determined without any inspection of the command line to
16451645
be added::
16461646

16471647
>>> parser = argparse.ArgumentParser()
@@ -1712,7 +1712,7 @@ Partial parsing
17121712

17131713
.. method:: ArgumentParser.parse_known_args(args=None, namespace=None)
17141714

1715-
Sometimes a script may only parse a few of the command line arguments, passing
1715+
Sometimes a script may only parse a few of the command-line arguments, passing
17161716
the remaining arguments on to another script or program. In these cases, the
17171717
:meth:`parse_known_args` method can be useful. It works much like
17181718
:meth:`~ArgumentParser.parse_args` except that it does not produce an error when

0 commit comments

Comments
 (0)