From c77e975a31a653de5324ce5a233cab91ade38080 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Sun, 5 Feb 2023 19:08:13 -0800 Subject: [PATCH] Add a script to ensure new lines exist in all files. --- tools/ensure-new-lines.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 tools/ensure-new-lines.sh diff --git a/tools/ensure-new-lines.sh b/tools/ensure-new-lines.sh new file mode 100755 index 0000000..c4f13ea --- /dev/null +++ b/tools/ensure-new-lines.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -e + +git ls-files -z | while IFS= read -rd '' f +do + if file --mime-encoding "$f" | grep -qv binary + then + tail -c1 < "$f" | read -r _ || echo >> "$f" + fi +done