Skip to content
Myr

:memo: Update path docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sebastián Ramírez · committed by GitHub · parents 5876605, ff8a1e4 · Browse files · 3 files+22 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+22 added−2 removed

  • tests:+7 added−0 removed
  • other:+15 added−2 removed

3 files+22 added−2 removed

modified:docs/src/parameter_types/path/tutorial001.py+4 added-1 removed
1 unmodified line
23import typer456def main(config: Path = typer.Option(...)):6def main(config: Path = typer.Option(None)):7 if config is None:8 typer.echo("No config file")9 raise typer.Abort()10 if config.is_file():11 text = config.read_text()12 typer.echo(f"Config file contents: {text}")13 elif config.is_dir():
7 unmodified lines
modified:docs/tutorial/parameter-types/path.md+11 added-1 removed
modified:tests/test_tutorial/test_parameter_types/test_path/test_tutorial001.py+7 added
12 unmodified lines
1314config_file = Path("./config.txt")151617def test_no_path():18 result = runner.invoke(app)19 assert result.exit_code == 120 assert "No config file" in result.output21 assert "Aborted!" in result.output222324def test_not_exists():25 if config_file.exists(): # pragma no cover26 config_file.unlink()27 result = runner.invoke(app, ["--config", f"{config_file}"])
26 unmodified lines