Coverage for tests/assets/cli/multi_app.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-03-10 00:15 +0000

1import typer 1iabcdefgh

2 

3sub_app = typer.Typer() 1iabcdefgh

4 

5variable = "Some text" 1iabcdefgh

6 

7 

8@sub_app.command() 1iabcdefgh

9def hello(name: str = "World", age: int = typer.Option(0, help="The age of the user")): 1iabcdefgh

10 """ 

11 Say Hello 

12 """ 

13 typer.echo(f"Hello {name}") 1iabcdefgh

14 

15 

16@sub_app.command() 1iabcdefgh

17def hi(user: str = typer.Argument("World", help="The name of the user to greet")): 1iabcdefgh

18 """ 

19 Say Hi 

20 """ 

21 

22 

23@sub_app.command() 1iabcdefgh

24def bye(): 1abcdefgh

25 """ 

26 Say bye 

27 """ 

28 typer.echo("sub bye") 1iabcdefgh

29 

30 

31app = typer.Typer(help="Demo App", epilog="The end") 1iabcdefgh

32app.add_typer(sub_app, name="sub") 1iabcdefgh

33 

34 

35@app.command() 1iabcdefgh

36def top(): 1abcdefgh

37 """ 

38 Top command 

39 """ 

40 typer.echo("top") 1iabcdefgh