check-markdown.sh 781 B

123456789101112131415161718192021
  1. #!/usr/bin/env bash
  2. set -eo pipefail
  3. script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  4. cd "${script_path}/.."
  5. if [ -z "${MARKDOWN_CHECK_BINARY:-}" ] ; then
  6. if ! [ -d Build/lagom/ ] ; then
  7. echo "Directory Build/lagom/ does not exist. Skipping markdown check."
  8. exit 0
  9. fi
  10. if ! [ -r Build/lagom/markdown-check ] ; then
  11. echo "Lagom executable markdown-check was not built. Skipping markdown check."
  12. echo "To enable this check, you may need to run './Meta/serenity.sh build lagom' first."
  13. exit 0
  14. fi
  15. MARKDOWN_CHECK_BINARY="Build/lagom/markdown-check"
  16. fi
  17. find AK Base Documentation Kernel Meta Ports Tests Userland -path 'Ports/*/*' -prune -o -type f -name '*.md' -print0 | xargs -0 "${MARKDOWN_CHECK_BINARY}" README.md