check-markdownfmt.sh 338 B

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. set -Eeuo pipefail
  3. cd "$(dirname "$(readlink -f "$BASH_SOURCE")")/.."
  4. files="$(
  5. find \( \
  6. -name '*.md' \
  7. -not -name 'README.md' \
  8. \) -print0 \
  9. | xargs -0 markdownfmt -l)"
  10. if [ "$files" ]; then
  11. echo >&2 'Need markdownfmt:'
  12. echo >&2 "$files"
  13. echo >&2
  14. echo "$files" | xargs markdownfmt -d >&2
  15. exit 1
  16. fi