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