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

16 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-09 18:26 +0000

1import typer 1habcdefg

2 

3sub_app = typer.Typer() 1habcdefg

4 

5variable = "Some text" 1habcdefg

6 

7 

8@sub_app.command() 1habcdefg

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

10 """ 

11 Say Hello 

12 """ 

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

14 

15 

16@sub_app.command() 1habcdefg

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

18 """ 

19 Say Hi 

20 """ 

21 

22 

23@sub_app.command() 1habcdefg

24def bye(): 1abcdefg

25 """ 

26 Say bye 

27 """ 

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

29 

30 

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

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

33 

34 

35@app.command() 1habcdefg

36def top(): 1abcdefg

37 """ 

38 Top command 

39 """ 

40 typer.echo("top") 1habcdefg