How to use the typer.confirm function in typer

To help you get started, we’ve selected a few typer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tiangolo / typer / docs_src / prompt / tutorial003.py View on Github external
def main():
    delete = typer.confirm("Are you sure you want to delete it?", abort=True)
    typer.echo("Deleting it!")
github cuducos / bot-followers / env.py View on Github external
def can_write_to_path(self) -> bool:
        if self.overwrite or not self.path.exists():
            return True

        echo(f"There is an existing {self.path.name} file.")
        return confirm("Do you want to overwrite it?")
github tiangolo / typer / docs_src / prompt / tutorial002.py View on Github external
def main():
    delete = typer.confirm("Are you sure you want to delete it?")
    if not delete:
        typer.echo("Not deleting")
        raise typer.Abort()
    typer.echo("Deleting it!")