-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
gh-84116: Docs: Document help and aliases for argparse.add_parser() #140574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
810fde1
b9ca059
bfbf864
16a1c46
639865d
3f0aa48
343648b
4b07ba3
8bb4bae
3361447
100207d
0f27e63
7e6102a
a76954c
ac2b754
b08e8ed
fa1d877
e955fb0
3d4cf26
e3af10b
59a1ad9
defd2c3
cd445fc
2e270ef
3e87e19
1867c71
ef450f6
4d27843
83ff9bf
77cc182
1a5c449
2dd07bb
850c986
7f95d28
18cbbae
554a3ca
312aa0f
53031db
6afe4d5
a10e6a5
d551718
6f94eda
d0ccf81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Krishna-web-hub marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1664,7 +1664,7 @@ | |
| [dest], [required], \ | ||
| [help], [metavar]) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add back this documentation! We only want to document
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added the changes only having
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the diff, no. I don't see where the |
||
|
|
||
| Many programs split up their functionality into a number of subcommands, | ||
|
Check warning on line 1667 in Doc/library/argparse.rst
|
||
| for example, the ``svn`` program can invoke subcommands like ``svn | ||
| checkout``, ``svn update``, and ``svn commit``. Splitting up functionality | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For instance where is this line? it's not here anymore. |
||
| this way can be a particularly good idea when a program performs several | ||
|
|
@@ -1672,10 +1672,24 @@ | |
| :class:`ArgumentParser` supports the creation of such subcommands with the | ||
| :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method is normally | ||
| called with no arguments and returns a special action object. This object | ||
| has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a | ||
| command name and any :class:`!ArgumentParser` constructor arguments, and | ||
| returns an :class:`!ArgumentParser` object that can be modified as usual. | ||
|
|
||
| has a single method, :meth:`~_SubParsersAction.add_parser`: | ||
Krishna-web-hub marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| .. method:: _SubParsersAction.add_parser(name, *, help=None, aliases=None, **kwargs) | ||
|
|
||
| Creates and returns a new :class:`!ArgumentParser` object for the | ||
| subcommand *name*. | ||
|
|
||
| :param name: The name of the sub-command. | ||
| :param help: A short description for this sub-command. If provided, | ||
| it will be listed next to the command in the main | ||
| parser's help message (e.g., ``PROG --help``). | ||
| :param aliases: A list or sequence of strings that can be used as | ||
| alternative names for this sub-command (e.g., ``aliases=['r']`` | ||
| for a ``'run'`` command). | ||
| :param kwargs: All other keyword arguments are passed directly to the | ||
| :class:`!ArgumentParser` constructor. | ||
|
|
||
| This returned :class:`!ArgumentParser` object can be modified as usual. | ||
|
|
||
| Description of parameters: | ||
|
|
||
| * *title* - title for the sub-parser group in help output; by default | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The section "descriptions of parameters" is tied to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you @picnixz , |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Update the free-threading how-to guide for 3.14 status. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Document ``help`` and ``aliases`` parameters for | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for a NEWS entry. You can delete this file.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @picnixz,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please delete the file. I'll add the label. In general, if the CI fails because of a lack of a NEWS, if you know that there shouldn't be a NEWS, just don't bother about the CI being red. A triager or a core dev will add the label when needed. |
||
| :meth:`argparse._SubParsersAction.add_parser` in the :mod:`argparse` | ||
| documentation. | ||
Uh oh!
There was an error while loading. Please reload this page.