Add confirmation prompt before overwriting existing encode.sh script
This commit is contained in:
@@ -58,6 +58,13 @@ def main(
|
|||||||
stream.film_grain = film_grain
|
stream.film_grain = film_grain
|
||||||
export_data = " ".join(data.cmd())
|
export_data = " ".join(data.cmd())
|
||||||
export_path = Path(filename).parent / "encode.sh"
|
export_path = Path(filename).parent / "encode.sh"
|
||||||
|
# Confirm overwrite if script exists
|
||||||
|
if export_path.exists():
|
||||||
|
if not typer.confirm(f"'{export_path}' already exists. Overwrite? "):
|
||||||
|
typer.echo("Aborting.")
|
||||||
|
raise typer.Exit()
|
||||||
|
else:
|
||||||
|
export_path.unlink()
|
||||||
write_shell_script(export_data, export_path)
|
write_shell_script(export_data, export_path)
|
||||||
print(Path(filename).parent)
|
print(Path(filename).parent)
|
||||||
print(" ".join(data.cmd()))
|
print(" ".join(data.cmd()))
|
||||||
|
|||||||
Reference in New Issue
Block a user