From cf4b7fa1065279fd49568da794798fe96651d3fe Mon Sep 17 00:00:00 2001 From: Esa Kataja Date: Thu, 17 Apr 2025 13:00:40 +0300 Subject: [PATCH] Add confirmation prompt before overwriting existing encode.sh script --- src/app.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app.py b/src/app.py index 355bef8..b9c9aac 100644 --- a/src/app.py +++ b/src/app.py @@ -58,6 +58,13 @@ def main( stream.film_grain = film_grain export_data = " ".join(data.cmd()) 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) print(Path(filename).parent) print(" ".join(data.cmd()))