]> granicus.if.org Git - python/commitdiff
Issue #9349: add argparse.SUPPRESS to help doc
authorSandro Tosi <sandro.tosi@gmail.com>
Tue, 3 Jan 2012 17:37:03 +0000 (18:37 +0100)
committerSandro Tosi <sandro.tosi@gmail.com>
Tue, 3 Jan 2012 17:37:03 +0000 (18:37 +0100)
Doc/library/argparse.rst

index 305a546d5422918cced2dd72894ea4dd7e999bfa..12684dbb8b1b7fc514769bb8fba8aa02d4885b8b 100644 (file)
@@ -1051,6 +1051,17 @@ specifiers include the program name, ``%(prog)s`` and most keyword arguments to
    optional arguments:
     -h, --help  show this help message and exit
 
+:mod:`argparse` supports silencing the help entry for certain options, by
+setting the ``help`` value to ``argparse.SUPPRESS``::
+
+   >>> parser = argparse.ArgumentParser(prog='frobble')
+   >>> parser.add_argument('--foo', help=argparse.SUPPRESS)
+   >>> parser.print_help()
+   usage: frobble [-h]
+
+   optional arguments:
+     -h, --help  show this help message and exit
+
 
 metavar
 ^^^^^^^