Source

py_stdlib_by_example / PyMOTW / optparse / optparse_metavar.py

#!/usr/bin/env python
"""Printing help with optparse.  

Call this script with --help on the command line.
"""
#end_pymotw_header

import optparse

parser = optparse.OptionParser()
parser.add_option('--no-foo', action="store_true", 
                  default=False, 
                  dest="foo",
                  help="Turn off foo",
                  )
parser.add_option('--with', action="store",
                  help="Include optional feature",
                  metavar='feature_NAME')

parser.parse_args()