clickEasy Examples

Composable CLI toolkit with decorators for options and arguments

Getting started with click

Installation and basic usage of click.

python
# Install: pip install click
import click

@click.command()
@click.option("--name", default="World", help="Who to greet")
@click.option("--count", default=1, help="Number of greetings")
def hello(name, count):
    for _ in range(count):
        click.echo(f"Hello, {name}!")

if __name__ == "__main__":
    hello()
Expected Output
# Expected output shown below
# (Run locally with: click)

click is a third-party package. Composable CLI toolkit with decorators for options and arguments. Install with: pip install click

Common click operations

Frequently used features of click.

python
# Install: pip install click
import click

# Common click patterns
print(f"click version: {click.__version__}")

These are the most commonly used features of click in everyday development.

Want to try these examples interactively?

Open Easy Playground