def add_argument(*args, **kwargs):
    """
    Define an argument for the function when running in console script
    mode.  The positional and keyword arguments are the same as for
    ArgumentParser.add_argument().
    """

    def decorator(func):
        func = ScriptAdaptor._wrap(func)
        func._add_argument(args, kwargs)
        return func
    return decorator
Define an argument for the function when running in console script
    mode.  The positional and keyword arguments are the same as for
    ArgumentParser.add_argument().