aboutsummaryrefslogtreecommitdiff
path: root/.githooks/pre-commit
blob: 7381a812128f416f0975cd4cb697c2e0d9d61a2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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"