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