Coverage for docs_src/parameter_types/path/tutorial002_an.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-19 20:29 +0000

1from pathlib import Path 1abcdefghi

2 

3import typer 1abcdefghi

4from typing_extensions import Annotated 1abcdefghi

5 

6app = typer.Typer() 1abcdefghi

7 

8 

9@app.command() 1abcdefghi

10def main( 1abcdefghi

11 config: Annotated[ 

12 Path, 

13 typer.Option( 

14 exists=True, 

15 file_okay=True, 

16 dir_okay=False, 

17 writable=False, 

18 readable=True, 

19 resolve_path=True, 

20 ), 

21 ], 

22): 

23 text = config.read_text() 1abcdefghi

24 print(f"Config file contents: {text}") 1abcdefghi

25 

26 

27if __name__ == "__main__": 1abcdefghi

28 app() 1abcdefghi