Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(config: Path = typer.Option(None)):
if config is None:
typer.echo("No config file")
raise typer.Abort()
if config.is_file():
text = config.read_text()
typer.echo(f"Config file contents: {text}")
elif config.is_dir():
typer.echo("Config is a directory, will use all its config files")
elif not config.exists():
typer.echo("The config doesn't exist")
def main(username: str):
if username == "root":
typer.echo("The root user is reserved")
raise typer.Abort()
typer.echo(f"New user created: {username}")
def main(user: List[str] = typer.Option(None)):
if not user:
typer.echo("No provided users")
raise typer.Abort()
for u in user:
typer.echo(f"Processing user: {u}")
def main(user: Tuple[str, int, bool] = typer.Option((None, None, None))):
username, coins, is_wizard = user
if not username:
typer.echo("No user provided")
raise typer.Abort()
typer.echo(f"The username {username} has {coins} coins")
if is_wizard:
typer.echo("And this user is a wizard!")
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!")