def prompt_overwrite(file_name):
# Skip if file doesn't exist
if not os.path.exists(file_name):
return True
# Prompt for file overwrite if outfile already exists
fmt = "File ({}) already exists. Do you want to overwrite? (y/n): "
message = fmt.format(file_name)
click.secho(message, nl=False, fg="red")
choice = click.getchar()
click.echo()
if choice not in ("y", "Y"):
return False
return True
评论列表
文章目录