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

16 statements  

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

1import typer 1abcdefgh

2 

3sub_app = typer.Typer() 1abcdefgh

4 

5variable = "Some text" 1abcdefgh

6 

7 

8@sub_app.command() 1abcdefgh

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

10 """ 

11 Say Hello 

12 """ 

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

14 

15 

16@sub_app.command() 1abcdefgh

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

18 """ 

19 Say Hi 

20 """ 

21 

22 

23@sub_app.command() 1abcdefgh

24def bye(): 1abcdefgh

25 """ 

26 Say bye 

27 """ 

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

29 

30 

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

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

33 

34 

35@app.command() 1abcdefgh

36def top(): 1abcdefgh

37 """ 

38 Top command 

39 """ 

40 typer.echo("top") 1abcdefgh