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