Skip to content
Myr

:memo: Add docs for asking with a prompt

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 Sebastián Ramírez · parent 63db894 · Browse files · 5 files+112 added−0 removed
This commit

State

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

Diff stats

5 files+112 added−0 removed

  • other:+112 added−0 removed

5 files+112 added−0 removed

added:docs/src/prompt/tutorial001.py+10 added
1import typer234def main():5 person_name = typer.prompt("What's your name?")6 typer.echo(f"Hello {person_name}")789if __name__ == "__main__":10 typer.run(main)
added:docs/src/prompt/tutorial002.py+13 added
1import typer234def main():5 delete = typer.confirm("Are you sure you want to delete it?")6 if not delete:7 typer.echo("Not deleting")8 raise typer.Abort()9 typer.echo("Deleting it!")101112if __name__ == "__main__":13 typer.run(main)
added:docs/src/prompt/tutorial003.py+10 added
1import typer234def main():5 delete = typer.confirm("Are you sure you want to delete it?", abort=True)6 typer.echo("Deleting it!")789if __name__ == "__main__":10 typer.run(main)
added:docs/tutorial/prompt.md+78 added
modified:mkdocs.yml+1 added