Coverage for docs_src / printing / tutorial005_py310.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-03-26 21:46 +0000

1import typer 1abcdefg

2 

3app = typer.Typer() 1abcdefg

4 

5 

6@app.command() 1abcdefg

7def main(good: bool = True): 1abcdefg

8 message_start = "everything is " 1abcdefg

9 if good: 1abcdefg

10 ending = typer.style("good", fg=typer.colors.GREEN, bold=True) 1abcdefg

11 else: 

12 ending = typer.style("bad", fg=typer.colors.WHITE, bg=typer.colors.RED) 1abcdefg

13 message = message_start + ending 1abcdefg

14 typer.echo(message) 1abcdefg

15 

16 

17if __name__ == "__main__": 1abcdefg

18 app() 1abcdefg