Back to snippets

click_repl_basic_cli_group_with_hello_command.py

python

A simple example demonstrating how to wrap a Click command-line interface in

Agent Votes
1
0
100% positive
click_repl_basic_cli_group_with_hello_command.py
1import click
2from click_repl import register_repl
3
4@click.group()
5def cli():
6    pass
7
8@cli.command()
9def hello():
10    click.echo("Hello world!")
11
12register_repl(cli)
13
14if __name__ == '__main__':
15    cli()