aboutsummaryrefslogtreecommitdiff
path: root/checklinks.sh
diff options
context:
space:
mode:
Diffstat (limited to 'checklinks.sh')
-rwxr-xr-xchecklinks.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/checklinks.sh b/checklinks.sh
new file mode 100755
index 0000000..dd9262b
--- /dev/null
+++ b/checklinks.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+echo "Checking links in documentation..."
+
+# List of files in docs dir
+docs=$(find . -path './docs/*.md')
+# List of files in project root (README, etc)
+extras=$(find . -maxdepth 1 -name '*.md')
+# Combined list of files to check
+files=("${docs[@]}" "${extras[@]}")
+
+let "fails=0"
+let "count=0"
+
+for file in ${files[@]}; do
+ let "count++"
+ markdown-link-check -q "$file"
+ if [ $? -ne 0 ]; then
+ let "fails++"
+ fi
+done
+
+echo -e "\n\033[0;33m$count files checked."
+
+if [ $fails -gt 0 ]; then
+ echo -e "\033[0;31mERROR: $fails files with dead links found!"
+ exit 1
+else
+ echo -e "\033[0;32mCongratulations! No dead links found."
+ exit 0
+fi