Coverage for docs_src / using_click / tutorial004_py39.py: 100%
17 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-02-09 12:36 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-02-09 12:36 +0000
1import click 1abcdefgh
2import typer 1abcdefgh
5@click.group() 1abcdefgh
6def cli(): 1abcdefgh
7 pass 1abcdefgh
10@cli.command() 1abcdefgh
11def initdb(): 1abcdefgh
12 click.echo("Initialized the database") 1abcdefgh
15@cli.command() 1abcdefgh
16def dropdb(): 1abcdefgh
17 click.echo("Dropped the database") 1abcdefgh
20app = typer.Typer() 1abcdefgh
23@app.command() 1abcdefgh
24def sub(): 1abcdefgh
25 """
26 A single-command Typer sub app
27 """
28 print("Typer is now below Click, the Click app is the top level") 1abcdefgh
31typer_click_object = typer.main.get_command(app) 1abcdefgh
33cli.add_command(typer_click_object, "sub") 1abcdefgh
35if __name__ == "__main__": 1abcdefgh
36 cli() 1abcdefgh