blob: 5f17618e4936a23b6f73836060ed0c264289b3b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env bash
set -e
exit_code=0
tag_regex='[gb]\?:\?\(ale\|ALE\)[a-zA-Z_\-]\+'
tags="$(mktemp -t tags.XXXXXXXX)"
refs="$(mktemp -t refs.XXXXXXXX)"
result="$(mktemp -t refs.XXXXXXXX)"
# Grep for tags and references, and complain if we find a reference without
# a tag for the reference. Only our tags will be included.
grep --exclude=tags -roh "\\*$tag_regex\\*" doc | sed 's/*//g' | sort -u > "$tags"
grep --exclude=tags -roh "|$tag_regex|" doc | sed 's/|//g' | sort -u > "$refs"
# Collect tags in a file we can display to the user if there are differences.
comm -23 "$refs" "$tags" > "$result"
exit_code=0
# If there are differences, show them and error out.
if ! [[ $(wc -l < "$result") -eq 0 ]]; then
cat "$result"
exit_code=1
fi
rm "$tags"
rm "$refs"
rm "$result"
exit $exit_code
|