diff options
Diffstat (limited to 'repo')
| -rwxr-xr-x | repo/hooks/check-links.sh | 5 | ||||
| -rwxr-xr-x | repo/hooks/pre-push | 3 | ||||
| -rwxr-xr-x | repo/hooks/setup.sh | 3 | ||||
| -rwxr-xr-x | repo/update-count.sh | 29 |
4 files changed, 40 insertions, 0 deletions
diff --git a/repo/hooks/check-links.sh b/repo/hooks/check-links.sh new file mode 100755 index 0000000..5681326 --- /dev/null +++ b/repo/hooks/check-links.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "Checking for unresolved links…" + +! grep -Er '^\[.*\]:.*TODO.*' diff --git a/repo/hooks/pre-push b/repo/hooks/pre-push new file mode 100755 index 0000000..ad0e03f --- /dev/null +++ b/repo/hooks/pre-push @@ -0,0 +1,3 @@ +#/bin/bash + +./repo/hooks/check-links.sh diff --git a/repo/hooks/setup.sh b/repo/hooks/setup.sh new file mode 100755 index 0000000..ffb52ca --- /dev/null +++ b/repo/hooks/setup.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +git config --local core.hooksPath repo/hooks diff --git a/repo/update-count.sh b/repo/update-count.sh new file mode 100755 index 0000000..d0a094e --- /dev/null +++ b/repo/update-count.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +list-tracked () +{ + GIT_LITERAL_PATHSPECS='' git ls-files '*.md' '*.org' +} + +count-leaks () +{ + let pages=0 + let words=0 + + while read filename + do + let words+=$(git show HEAD:${filename} | wc -w | cut -d' ' -f1) + let pages+=1 + done + + echo ${words} ${pages} +} + + + +read words pages < <(list-tracked | count-leaks) + +pattern="[0-9]* words in [0-9]* pages" +actual="${words} words in ${pages} pages" + +sed -i "s/${pattern}/${actual}/" README.md |
