Skip to content

Commit 3f0aa48

Browse files
doc fixing of the cpython fixes#84116
1 parent 639865d commit 3f0aa48

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Doc/library/argparse.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,10 +1672,24 @@ Sub-commands
16721672
:class:`ArgumentParser` supports the creation of such subcommands with the
16731673
:meth:`!add_subparsers` method. The :meth:`!add_subparsers` method is normally
16741674
called with no arguments and returns a special action object. This object
1675-
has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a
1676-
command name and any :class:`!ArgumentParser` constructor arguments, and
1677-
returns an :class:`!ArgumentParser` object that can be modified as usual.
1678-
1675+
has a single method, :meth:`~_SubParsersAction.add_parser`:
1676+
.. method:: _SubParsersAction.add_parser(name, *, help=None, aliases=None, **kwargs)
1677+
1678+
Creates and returns a new :class:`!ArgumentParser` object for the
1679+
subcommand *name*.
1680+
1681+
:param name: The name of the sub-command.
1682+
:param help: A short description for this sub-command. If provided,
1683+
it will be listed next to the command in the main
1684+
parser's help message (e.g., ``PROG --help``).
1685+
:param aliases: A list or sequence of strings that can be used as
1686+
alternative names for this sub-command (e.g., ``aliases=['r']``
1687+
for a ``'run'`` command).
1688+
:param kwargs: All other keyword arguments are passed directly to the
1689+
:class:`!ArgumentParser` constructor.
1690+
1691+
This returned :class:`!ArgumentParser` object can be modified as usual.
1692+
16791693
Description of parameters:
16801694

16811695
* *title* - title for the sub-parser group in help output; by default

0 commit comments

Comments
 (0)