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

Class CommandLineParser

source code

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

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

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.OptionParser (private): _add_help_option, _add_version_option, _create_option_list, _get_all_options, _get_args, _get_encoding, _init_parsing_state, _match_long_opt, _populate_option_list, _process_args, _process_long_opt, _process_short_opts

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

Inherited from optparse.OptionContainer (private): _check_conflict, _create_option_mappings, _share_option_mappings

Class Variables [hide private]

Inherited from optparse.OptionParser: standard_option_list

Method Details [hide private]

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

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

print_help(self, out=sys.stderr)

source code 
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

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

source code 
Display a usage message and exit.
Parameters:
  • msg (str) - 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)

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