def task_id_arg(*args, **kwargs):
"""
This is the `TASK_ID` argument consumed by many Transfer Task operations.
It accept a toggle on whether or not it is required
Usage:
>>> @task_id_option
>>> def command_func(task_id):
>>> ...
or
>>> @task_id_option(required=False)
>>> def command_func(task_id):
>>> ...
By default, the task ID is made required; pass `required=False` to the
decorator arguments to make it optional.
"""
def inner_decorator(f, required=True):
f = click.argument('TASK_ID', required=required)(f)
return f
return detect_and_decorate(inner_decorator, args, kwargs)
评论列表
文章目录