]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#9112: document error() and exit() methods of ArgumentParser.
authorGeorg Brandl <georg@python.org>
Sun, 17 Oct 2010 10:28:04 +0000 (10:28 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 17 Oct 2010 10:28:04 +0000 (10:28 +0000)
Doc/library/argparse.rst

index f50492a421e8ea70fefbac9f795d8c3e141ba660..c2d7e73b714b607458c80088357a3f8c56786474 100644 (file)
@@ -1663,7 +1663,6 @@ printing it:
    information about the arguments registered with the :class:`ArgumentParser`.
 
 
-
 Partial parsing
 ^^^^^^^^^^^^^^^
 
@@ -1709,6 +1708,20 @@ Customizing file parsing
             yield arg
 
 
+Exiting methods
+^^^^^^^^^^^^^^^
+
+.. method:: ArgumentParser.exit(status=0, message=None)
+
+   This method terminates the program, exiting with the specified *status*
+   and, if given, it prints a *message* before that.
+
+.. method:: ArgumentParser.error(message)
+
+   This method prints a usage message including the *message* to the
+   standard output and terminates the program with a status code of 2.
+
+
 Upgrading optparse code
 -----------------------