import click
@click.command()
@click.option('--count', default=1, help='Number of greetings.')
@click.option('--name', prompt='Your name',
help='The person to greet.')
def hello(count, name):
"""Simple program that greets NAME for a total of COUNT times."""
for x in range(count):
click.echo('Hello %s!' % name)
if __name__ == '__main__':
hello()
运行输出如下,help用于参数说明,default用于设置默认值
$ python hello.py --count=3 Your name: John Hello John! Hello John! Hello John!
更多使用参考 https://click-docs-zh-cn.readthedocs.io/zh/latest/



