Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def maybe_create_user(username: str):
if username in existing_usernames:
typer.echo("The user already exists")
raise typer.Exit()
else:
typer.echo(f"User created: {username}")
def version_callback(value: bool):
if value:
typer.echo(f"Awesome CLI Version: {__version__}")
raise typer.Exit()
def main(birth: datetime):
typer.echo(f"Interesting day to be born: {birth}")
typer.echo(f"Birth hour: {birth.hour}")
def main(name: str = typer.Argument("World", hidden=True)):
"""
Say hi to NAME very gently, like Dirk.
"""
typer.echo(f"Hello {name}")
def create(username: str):
typer.echo(f"Creating user: {username}")
def name_callback(value: str):
typer.echo("Validating name")
if value != "Camila":
raise typer.BadParameter("Only Camila is allowed")
return value
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!")
def create(username: str):
typer.echo(f"Creating user: {username}")
def main(name: str):
typer.echo(f"Hello {name}")
def delete():
typer.echo("Deleting user: Hiro Hamada")