#!/usr/bin/env bash
# Validate READMEs for this repo, which must have an
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"