【发布时间】:2022-08-11 05:24:08
【问题描述】:
我有一个 CLI 工具,并且在其中一个命令中有 click.argument。
最初,我有这个:
@click.argument(
\'file\',
type=click.Path(exists=True),
)
如果我没有在命令中添加file 参数,它曾经抛出这样的错误:
Error: Missing argument \'FILE\'.
现在,我通过像这样添加nargs=-1 添加了无限数量的参数的可能性:
@click.argument(
\'file\',
nargs=-1,
type=click.Path(exists=True),
)
现在,如果我不传递 file 参数,我不会收到上述错误消息。
我可能会错过什么?
标签: python arguments click command-line-interface