Coverage for src/ss_python/cli.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-20 05:32 +0000

1"""Command Line Interface.""" 

2 

3import typer 

4 

5app = typer.Typer() 

6 

7 

8@app.command() 

9def run() -> None: 

10 """Run command.""" 

11 

12 

13# NOTE(huxuan): callback is required for single command as a subcommand in typer. 

14# And it is a convenient way to document the cli here. 

15# Reference: https://typer.tiangolo.com/tutorial/commands/one-or-multiple/#one-command-and-one-callback 

16@app.callback(no_args_is_help=True) 

17def main() -> None: 

18 """CLI for Serious Scaffold Python.""" 

19 

20 

21# NOTE(huxuan): click object is used for document generation. 

22# Reference: https://github.com/tiangolo/typer/issues/200#issuecomment-796485787 

23typer_click_object = typer.main.get_command(app)