[Python-checkins] cpython (merge 3.3 -> default): merge with 3.3
georg.brandl
python-checkins at python.org
Sun Oct 6 18:56:26 CEST 2013
http://hg.python.org/cpython/rev/ad8a5cf3a213
changeset: 86110:ad8a5cf3a213
parent: 86108:b0295cc736d8
parent: 86109:b930b4e67c8a
user: Georg Brandl <georg at python.org>
date: Sun Oct 06 18:57:02 2013 +0200
summary:
merge with 3.3
files:
Doc/library/argparse.rst | 29 +++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1452,7 +1452,10 @@
Sub-commands
^^^^^^^^^^^^
-.. method:: ArgumentParser.add_subparsers()
+.. method:: ArgumentParser.add_subparsers([title], [description], [prog], \
+ [parser_class], [action], \
+ [option_string], [dest], [help], \
+ [metavar])
Many programs split up their functionality into a number of sub-commands,
for example, the ``svn`` program can invoke sub-commands like ``svn
@@ -1466,6 +1469,30 @@
command name and any :class:`ArgumentParser` constructor arguments, and
returns an :class:`ArgumentParser` object that can be modified as usual.
+ Description of parameters:
+
+ * title - title for the sub-parser group in help output; by default
+ "subcommands" if description is provided, otherwise uses title for
+ positional arguments
+
+ * description - description for the sub-parser group in help output, by
+ default None
+
+ * prog - usage information that will be displayed with sub-command help,
+ by default the name of the program and any positional arguments before the
+ subparser argument
+
+ * parser_class - class which will be used to create sub-parser instances, by
+ default the class of the current parser (e.g. ArgumentParser)
+
+ * dest - name of the attribute under which sub-command name will be
+ stored; by default None and no value is stored
+
+ * help - help for sub-parser group in help output, by default None
+
+ * metavar - string presenting available sub-commands in help; by default it
+ is None and presents sub-commands in form {cmd1, cmd2, ..}
+
Some example usage::
>>> # create the top-level parser
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list