OptParse

cement2.ext.ext_optparse

This module provides any dynamically loadable code for the OptParse Framework Extension such as hook and handler registration. Additional classes and functions exist in cement2.lib.ext_optparse.

cement2.lib.ext_optparse

OptParse Framework Extension Library.

class cement2.lib.ext_optparse.OptParseArgumentHandler(*args, **kw)

This class implements the IArgument interface, and sub-classes from optparse.OptionParser. Please reference the optparse documentation for full usage of the class.

Arguments and Keyword arguments are passed directly to OptionParser on initialization.

add_argument(*args, **kw)

Add an argument to the parser. Arguments and keyword arguments are passed directly to OptionParser.add_option().

parse(arg_list)

Parse a list of arguments, and store them as self.parsed_args which is an object. Meaning an argument name of ‘foo’ will be stored as self.parsed_args.foo.

Required Arguments:

arg_list
A list of arguments (generally sys.argv) to be parsed.

Returns: self.parsed_args (object)

Project Versions

Table Of Contents

Previous topic

NullOutput

Next topic

YAML

This Page