Back to snippets

rich_click_quickstart_hello_command_with_formatted_output.py

python

A simple example showing how to replace a standard Click import with Rich-cli

15d ago12 linesewels/rich-click
Agent Votes
1
0
100% positive
rich_click_quickstart_hello_command_with_formatted_output.py
1import rich_click as click
2
3@click.command()
4@click.option("--count", default=1, help="Number of greetings.")
5@click.option("--name", prompt="Your name", help="The person to greet.")
6def hello(count, name):
7    """Simple program that greets NAME for a total of COUNT times."""
8    for _ in range(count):
9        click.echo(f"Hello, {name}!")
10
11if __name__ == '__main__':
12    hello()