def argument_list(cls, name):
"""
A `click.argument` decorator that accepts zero or more command-line
arguments and converts them all to instances of the class. If
`default_params` is not `None`, an empty argument list will be
defaulted to the resource type's default value.
"""
if cls.default_params is not None:
def callback(ctx, param, value):
return value or [cls.default(ctx.obj)]
else:
callback = None
return click.argument(
name,
type=ResourceParamType(cls),
nargs=-1,
callback=callback,
)
评论列表
文章目录