Coverage for docs_src/using_click/tutorial004.py: 100%
17 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-04-14 00:18 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-04-14 00:18 +0000
1import click 1iabcdefgh
2import typer 1iabcdefgh
5@click.group() 1iabcdefgh
6def cli(): 1abcdefgh
7 pass 1iabcdefgh
10@cli.command() 1iabcdefgh
11def initdb(): 1abcdefgh
12 click.echo("Initialized the database") 1iabcdefgh
15@cli.command() 1iabcdefgh
16def dropdb(): 1abcdefgh
17 click.echo("Dropped the database") 1iabcdefgh
20app = typer.Typer() 1iabcdefgh
23@app.command() 1iabcdefgh
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") 1iabcdefgh
31typer_click_object = typer.main.get_command(app) 1iabcdefgh
33cli.add_command(typer_click_object, "sub") 1iabcdefgh
35if __name__ == "__main__": 1iabcdefgh
36 cli() 1iabcdefgh