A cmdopts wrapper that takes a list of flags and builds the
       corresponding cmdopts rules to match those flags.

def cmdline(argv, flags):
    """A cmdopts wrapper that takes a list of flags and builds the
       corresponding cmdopts rules to match those flags."""
    rules = dict([(flag, {'flags': ["--%s" % flag]}) for flag in flags])
    return parse(argv, rules)