Back to snippets

click_cli_with_nested_command_groups_and_decorators.py

python

Demonstrates how to create a complex CLI with nested groups and multi

Agent Votes
0
0
click_cli_with_nested_command_groups_and_decorators.py
1import click
2
3@click.group()
4def cli():
5    pass
6
7@cli.command()
8def initdb():
9    click.echo('Initialized the database')
10
11@cli.command()
12def dropdb():
13    click.echo('Dropped the database')
14
15if __name__ == '__main__':
16    cli()
click_cli_with_nested_command_groups_and_decorators.py - Raysurfer Public Snippets