On this page
article
Click CLI
Build a command-line interface with Click.
Category: click
Problem
Build a command-line interface with Click.
Solution
@click.command()
@click.option("--name", default="World")
def hello(name):
click.echo(f"Hello {name}")
Notes
- Adapt variable names and paths to your project
- Add error handling for production use
- See related chapters in the Learning Path