pip install click
python
import click
python
@click.command()
def hello():
click.echo('Hello, world!')
python
@click.command()
@click.option('--name', prompt='Your name', help='Enter your name')
def hello(name):
click.echo('Hello, ' + name + '!')
python
@click.group()
def cli():
pass
@click.command()
def greet():
click.echo('Hello!')
@click.command()
def goodbye():
click.echo('Goodbye!')
cli.add_command(greet)
cli.add_command(goodbye)
python
if __name__ == '__main__':
cli()
python script.py hello
python script.py greet
python script.py goodbye