cpython: d5027e489c25 (original) (raw)
Mercurial > cpython
changeset 86111:d5027e489c25 2.7
Closes #11807: document argparse add_subparsers method better. Patch by Filip GruszczyĆski. [#11807]
Georg Brandl georg@python.org | |
---|---|
date | Sun, 06 Oct 2013 18:51:39 +0200 |
parents | 3e5078c3784e |
children | 74ae6064d3e8 |
files | Doc/library/argparse.rst |
diffstat | 1 files changed, 28 insertions(+), 1 deletions(-)[+] [-] Doc/library/argparse.rst 29 |
line wrap: on
line diff
--- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1432,7 +1432,10 @@ Other utilities Sub-commands ^^^^^^^^^^^^ -.. method:: ArgumentParser.add_subparsers() +.. method:: ArgumentParser.add_subparsers([title], [description], [prog], [](#l1.8)
[parser_class], [action], \[](#l1.9)
[option_string], [dest], [help], \[](#l1.10)
[metavar])[](#l1.11)
Many programs split up their functionality into a number of sub-commands,
for example, the svn
program can invoke sub-commands like ``svn
@@ -1446,6 +1449,30 @@ Sub-commands
command name and any :class:ArgumentParser
constructor arguments, and
returns an :class:ArgumentParser
object that can be modified as usual.
- Description of parameters: +
"subcommands" if description is provided, otherwise uses title for[](#l1.22)
positional arguments[](#l1.23)
by default the name of the program and any positional arguments before the[](#l1.29)
subparser argument[](#l1.30)
default the class of the current parser (e.g. ArgumentParser)[](#l1.33)
stored; by default None and no value is stored[](#l1.36)
is None and presents sub-commands in form {cmd1, cmd2, ..}[](#l1.41)