Package wsatools :: Module CLI :: Class ArgGroup
[hide private]

Class ArgGroup

source code


Container to store the specified set of arguments required by the program. It has separate lists for mandatory and optional argument definitions, and is a dictionary of argument example values referenced by name. Supplied argument values from getopt are passed through to processArgs() to provide a command-line argument look-up table for the program.

Instance Methods [hide private]
new empty dictionary

__init__(self, argList=[])
Initialise with the list of argument definitions for this program.
source code
 
__add__(self, argList)
Create a new container by adding a new list of argument definitions to this container.
source code
 
__iadd__(self, argList)
Increment the list of argument definitions with additional arguments.
source code
 
append(self, arg)
Add a single argument.
source code
str
getArgStr(self)
Returns: The list of program arguments in order, mandatory first.
source code
str
getExampleStr(self)
Returns: The example usage string for typical argument values.
source code
dict{str : str}
processArgs(self, argVals=[])
Processes the argument values supplied on the command-line, to return a look-up table to obtain argument values from their names.
source code
 
remove(self, name)
Removes specified argument from the list of supported arguments.
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, argList=[])
(Constructor)

source code 

Initialise with the list of argument definitions for this program.

Parameters:
  • argList (list(CLI.Argument)) - List of argument definitions for this program.
Returns:
new empty dictionary

Overrides: object.__init__

append(self, arg)

source code 

Add a single argument.

Parameters:
  • arg (CLI.Argument) - Argument to add to group of arguments.

getArgStr(self)

source code 
Returns: str
The list of program arguments in order, mandatory first.

getExampleStr(self)

source code 
Returns: str
The example usage string for typical argument values.

processArgs(self, argVals=[])

source code 

Processes the argument values supplied on the command-line, to return a look-up table to obtain argument values from their names.

Parameters:
  • argVals (list(str)) - List of argument values (e.g. from getopt)
Returns: dict{str : str}
Loop-up table for command-line argument values.

remove(self, name)

source code 

Removes specified argument from the list of supported arguments.

Parameters:
  • name (str) - Argument name.