Decorates a class to handle the arguments parser.

def class_args(cls):
    """
    Decorates a class to handle the arguments parser.
    """
    # get the Singleton
    ap_ = ArgParseInator(skip_init=True)
    # collect special vars (really need?)
    utils.collect_appendvars(ap_, cls)
    # set class reference
    cls.__cls__ = cls
    cmds = {}
    # get eventual class arguments
    cls.__arguments__ = getattr(cls, '__arguments__', [])
    # cycle through class functions
    for func in [f for f in cls.__dict__.values()
                 if hasattr(f, '__cmd_name__') and not inspect.isclass(f)]:
        # clear subcommands
        func.__subcommands__ = None
        # set the parent class
        func.__cls__ = cls
        # assign to commands dict
        cmds[func.__cmd_name__] = func
    if hasattr(cls, '__cmd_name__') and cls.__cmd_name__ not in ap_.commands:
        # if che class has the __cmd_name__ attribute and is not already present
        # in the ArgParseInator commands
        # set the class subcommands
        cls.__subcommands__ = cmds
        # add the class as ArgParseInator command
        ap_.commands[cls.__cmd_name__] = cls
    else:
        # else if we don't have a __cmd_name__
        # we will add all the functions directly to the ArgParseInator commands
        # if it don't already exists.
        for name, func in cmds.items():
            if name not in ap_.commands:
                ap_.commands[name] = func
    return cls