aboutsummaryrefslogtreecommitdiff
path: root/checklinks.sh
diff options
context:
space:
mode:
authorSadaf Ebrahimi <sadafebrahimi@google.com>2022-11-04 20:35:11 +0000
committerSadaf Ebrahimi <sadafebrahimi@google.com>2022-11-04 20:35:11 +0000
commitd11b75301624f3c59c7243ad1e75243446f5c229 (patch)
tree1a110fa9fa982e746b1969458c5b9d373c70a38c /checklinks.sh
parentf94cfcb46cac5900c86c14ab81db9aac90978889 (diff)
downloadmarkdown-d11b75301624f3c59c7243ad1e75243446f5c229.tar.gz
Upgrade markdown to 3.4.1
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update markdown For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md Test: TreeHugger Change-Id: I96b25097329b04dcfd580791826971ce299c12f1
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