aboutsummaryrefslogtreecommitdiff
path: root/.githooks
diff options
context:
space:
mode:
Diffstat (limited to '.githooks')
-rwxr-xr-x.githooks/pre-commit22
1 files changed, 22 insertions, 0 deletions
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
new file mode 100755
index 0000000..7381a81
--- /dev/null
+++ b/.githooks/pre-commit
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# Validate READMEs for this repo, which must have an <h2> describing how to
+# reload the configuration.
+#
+# This helps remember how to see the changes reflect. Every application does it
+# differently and it's annoying to figure out. Rebooting or logging out slows
+# iteration.
+#
+# If no README.md, ignore that directory.
+
+failed=0
+
+while IFS= read -r -d '' file; do
+ if ! grep -q '^## How to Reload' "$file"; then
+ printf 'File missing reloading section: %s\n' "$file"
+ failed=1
+ fi
+done < <(find . -mindepth 2 -maxdepth 2 -type f ! -path './.git/*' \
+ -name 'README.md' -print0)
+
+exit "$failed"