Coverage for docs_src / launch / tutorial002_py310.py: 100%
15 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-03-26 21:46 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-03-26 21:46 +0000
1from pathlib import Path 1abcdefg
3import typer 1abcdefg
5APP_NAME = "my-super-cli-app" 1abcdefg
7app = typer.Typer() 1abcdefg
10@app.command() 1abcdefg
11def main(): 1abcdefg
12 app_dir = typer.get_app_dir(APP_NAME) 1abcdefg
13 app_dir_path = Path(app_dir) 1abcdefg
14 app_dir_path.mkdir(parents=True, exist_ok=True) 1abcdefg
15 config_path: Path = Path(app_dir) / "config.json" 1abcdefg
16 if not config_path.is_file(): 1abcdefg
17 config_path.write_text('{"version": "1.0.0"}') 1abcdefg
18 config_file_str = str(config_path) 1abcdefg
19 print("Opening config directory") 1abcdefg
20 typer.launch(config_file_str, locate=True) 1abcdefg
23if __name__ == "__main__": 1abcdefg
24 app() 1abcdefg