From 4cfa7ed76b24fd3d7162293d1d5a10ed75c5ce39 Mon Sep 17 00:00:00 2001 From: Ohad Livne Date: Fri, 26 Dec 2025 00:01:52 +0200 Subject: [PATCH] Add input validation - the script only supports editing a single file --- .local/bin/run0edit | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.local/bin/run0edit b/.local/bin/run0edit index 0909e39..279f419 100755 --- a/.local/bin/run0edit +++ b/.local/bin/run0edit @@ -54,6 +54,12 @@ clean_tempfiles() { rm --force "${tempfile}" "${tempfile}.orig" } +if [ "$#" -ne "1" ]; then + echo "Expected exactly one input file. Usage:" 1>&2 + echo " $0 FILE" 1>&2 + exit 1; +fi + editor_cmd="$(default_editor)" echo "Editing using the command \"${editor_cmd}\""