summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
authorsteven.bethard <devnull@localhost>2009-03-28 16:59:39 +0000
committersteven.bethard <devnull@localhost>2009-03-28 16:59:39 +0000
commit56ed68dff0cbad6f7891f7ebc124a98053b5f08d (patch)
treec29c2a989fcfb567f9d28e34d62b3f730e363ccc /doc/source
parent9ebaae668a8aa599985a8b299298233f82e41512 (diff)
downloadargparse-56ed68dff0cbad6f7891f7ebc124a98053b5f08d.tar.gz
Document print_help() and friends.
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/other-methods.rst25
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/source/other-methods.rst b/doc/source/other-methods.rst
index cd86d8f..1003aa3 100644
--- a/doc/source/other-methods.rst
+++ b/doc/source/other-methods.rst
@@ -1,6 +1,31 @@
Other methods
=============
+Printing help
+-------------
+
+In most typical applications, :meth:`parse_args` will take care of formatting and printing any usage or error messages. However, should you want to format or print these on your own, several methods are available:
+
+.. method:: print_usage([file]):
+
+ Print a brief description of how the :class:`ArgumentParser` should be invoked on the command line. If ``file`` is not present, ``sys.stderr`` is assumed.
+
+.. method:: print_help([file]):
+
+ Print a help message, including the program usage and information about the arguments registered with the :class:`ArgumentParser`. If ``file`` is not present, ``sys.stderr`` is assumed.
+
+There are also variants of these methods that simply return a string instead of printing it:
+
+.. method:: format_usage():
+
+ Return a string containing a brief description of how the :class:`ArgumentParser` should be invoked on the command line.
+
+.. method:: format_help():
+
+ Return a string containing a help message, including the program usage and information about the arguments registered with the :class:`ArgumentParser`.
+
+
+
Parser defaults
---------------