diff options
| author | Henry J. Webster <hwebs@hwebs.info> | 2026-10-29 22:02:47 -0500 |
|---|---|---|
| committer | Henry J. Webster <hwebs@hwebs.info> | 2026-10-29 22:02:47 -0500 |
| commit | e59516531851e4a2cf8dc209179df547afb50a38 (patch) | |
| tree | c4af8b93b837785311c644553dbcbfcd75b35b2e /.githooks/pre-commit | |
| parent | 2cbacd12339d03eb613eba0c2f2388926e6e3da9 (diff) | |
add README validator
Diffstat (limited to '.githooks/pre-commit')
| -rwxr-xr-x | .githooks/pre-commit | 22 |
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" |
