Add input validation - the script only supports editing a single file

This commit is contained in:
Ohad Livne 2025-12-26 00:01:52 +02:00
parent 888434d5d9
commit 6a06a995b0
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D

View file

@ -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}\""