    clap - a command-line argument processing library


Command-line argument processing class
The constructor receives a list of lists in the format:
    short option, long option, info, description, arg description
and an optional string describing the arguments the program would expect,
if any.
Info describes what is expected from this argument. 
    If set to None, the option will be set to 1 if found present (once or
    multiple times)
        For instance, 
        foo --verbose --verbose 
        will set verbose's value to 1
    If set to one of IntType, StringType or FloatType, exactly one value 
    of the specified type is expected (and the last one wins).
        For instance,
        foo --foo=1 --foo=2
        will set foo's value to 2
    If set to a list, a list of values is returned.
    If the list is empty, it will behave like setting the option to None 
    and returning all occurences of the option in a list. This is useful
    if the number of flags is important (like increasing the verbosity
    level).
    If the list is not empty, the first item in the list has to be one
    IntType, StringType or FloatType; the return is a list with items of
    that type.
        For instance,
        foo --foo=1 --foo=2
        will set foo's value to [1, 2], if foo's info field was decribed 
        as [IntType]
If the string "help" replaces one of the table's lines, autohelp will be
generated too. Using --help or -? will print all the available options in
a nice format; --usage will shortly describe the arguments.

The process() method expects a list of arguments in sys.argv style. The
first item of the list should be the name of the program.

Two hashes allows one to retrieve the value of an object after processing.
hashShort will map short names to values
hashLong will map long names to values
getShort() and getLong() are methods returning items from the hashes.

Here is an example of how to use the class

table = [
    "help",
    ['v', 'verbose',     [], 'Increase verbosity'],
    ['d', 'dir',         StringType, 
            'Process packages from this directory (current dir)', 'DIR'],
    ['c', 'channel',     [StringType],
            'Manage this channel'],
    ['n', 'count',       IntType,
            'Process this number of headers per call'],
    ['l', 'list',        None,
            'Only list the specified channels'],
]
# Define the object
argObj = Clap(table, "Files")
argObj.process(arglist)

# Process the arguments
print argObj.getLong("channel")

