Package grizzled :: Module cmdline :: Class CommandLineParser
[frames] | no frames]

Class CommandLineParser

optparse.OptionContainer --+    
                           |    
       optparse.OptionParser --+
                               |
                              CommandLineParser

Custom version of command line option parser.
Instance Methods
 
__init__(self, *args, **kw)
Create a new instance.
 
print_help(self, out=sys.stderr)
Print the help message, followed by the epilogue (if set), to the specified output file.
 
show_usage(self, msg=None)
 
die_with_usage(self, msg=None, exit_code=2)
Display of the usage message and exit.
 
error(self, msg)
Overrides parent OptionParser class's error() method and forces the full usage message on error.

Inherited from optparse.OptionParser: add_option_group, check_values, destroy, disable_interspersed_args, enable_interspersed_args, exit, expand_prog_name, format_epilog, format_help, format_option_help, get_default_values, get_description, get_option_group, get_prog_name, get_usage, get_version, parse_args, print_usage, print_version, set_default, set_defaults, set_process_default_values, set_usage

Inherited from optparse.OptionContainer: add_option, add_options, format_description, get_option, has_option, remove_option, set_conflict_handler, set_description

Class Variables

Inherited from optparse.OptionParser: standard_option_list

Method Details

__init__(self, *args, **kw)
(Constructor)

 
Create a new instance.
Overrides: optparse.OptionContainer.__init__

print_help(self, out=sys.stderr)

 
Print the help message, followed by the epilogue (if set), to the specified output file. You can define an epilogue by setting the epilogue field.
Parameters:
  • out (file) - where to write the usage message
Overrides: optparse.OptionParser.print_help

show_usage(self, msg=None)

 
Decorators:
  • @deprecated(since= '0.8.3', message= 'Use die_with_usage()')

die_with_usage(self, msg=None, exit_code=2)

 
Display of the usage message and exit.
Parameters:
  • msg (string) - If not set to None (the default), this message will be displayed before the usage message
  • exit_code (int) - The process exit code. Defaults to 2.

error(self, msg)

 
Overrides parent OptionParser class's error() method and forces the full usage message on error.
Overrides: optparse.OptionParser.error