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

10 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-11-18 11:12 +0000

1import typer 1abcdefghij

2 

3app = typer.Typer() 1abcdefghij

4 

5 

6@app.command() 1abcdefghij

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

8 message_start = "everything is " 1abcdefghij

9 if good: 1abcdefghij

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

11 else: 

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

13 message = message_start + ending 1abcdefghij

14 typer.echo(message) 1abcdefghij

15 

16 

17if __name__ == "__main__": 1abcdefghij

18 app() 1abcdefghij