2.3.4 Option Help

The help and metavar arguments of the add_option() method are used to control the configuration option help text automatically generated by the print_help() method.

For example:

# file: help.py
import cfgparse
c = cfgparse.ConfigParser(description='Description of the option '
c.add_option('retries', type='int', help='Maximum number of retries.')
c.add_option('timeout', type='int', metavar='#SEC', 
             help='Seconds between retries.')

Results in:

$ python help.py
Description of the option configuration.

Configuration file options:
  retries=RETRIES  Maximum number of retries.
  timeout=#SEC     Seconds between retries.

metavar controls the setting representation on the right side of the option/setting pair in the help text. If metavar is not specified or set to None the destination attribute name (in upper case) is used. The destination attribute name is controlled by the name and dest arguments.