blob: beb580d7bce7c18a9e25ffc58a02c157c742150f (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/usr/bin/env bash
set -e
set -u
# This script compares the table of supported tools in both the README file
# and the doc/ale.txt file, so we can complain if they don't match up.
doc_file="$(mktemp -t doc.XXXXXXXX)"
doc_sorted_file="$(mktemp -t doc-sorted.XXXXXXXX)"
readme_file="$(mktemp -t readme.XXXXXXXX)"
while read -r; do
if [[ "$REPLY" =~ ^! ]]; then
language="${REPLY/!/}"
else
# shellcheck disable=SC2001
echo "$language - $REPLY"
fi
done < <(
grep '^\*\|^ *\*' doc/ale-supported-languages-and-tools.txt \
| sed -e '1,2d' \
| sed 's/^\* */!/' \
| sed 's/^ *\* *\|!!\|\^\|(.*)\|`//g' \
| sed 's/ *$//'
) > "$doc_file"
while read -r; do
if [[ "$REPLY" =~ ^! ]]; then
language="${REPLY/!/}"
else
# shellcheck disable=SC2001
echo "$language - $REPLY"
fi
done < <(
grep '^\*\|^ *\*' supported-tools.md \
| sed 's/^\* */!/' \
| sed 's/^ *\* *\|:floppy_disk:\|:warning:\|(.*)\|\[\|\].*\|-n flag//g' \
| sed 's/ *$//'
) > "$readme_file"
exit_code=0
# Sort the tools ignoring case, and complain when things are out of order.
sort -f -k1,2 "$doc_file" -o "$doc_sorted_file"
diff -U0 "$doc_sorted_file" "$doc_file" || exit_code=$?
if ((exit_code)); then
echo
echo "The supported tools list isn't sorted properly"
echo
fi
diff -U0 "$readme_file" "$doc_file" || exit_code=$?
rm "$doc_file"
rm "$doc_sorted_file"
rm "$readme_file"
exit "$exit_code"
|