aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow/assert-manpages.sh
blob: 2453c4856e780f1bfbcca1617fe60f6e13f84a79 (plain) (blame)
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
62
63
#!/bin/sh
set -eu

PROJECT="$1"
MAILING_LIST="$2"
shift
shift
TLD="$(cat aux/tld.txt)"

IN_PLACE=false
while getopts 'i' flag; do
	case "$flag" in
		i)
			IN_PLACE=true
			;;
		*)
			;;
	esac
done

EXPECTED="$(mktemp)"
cat <<EOF >> "$EXPECTED"
.
.
.SH AUTHORS
.P
.MT eu@euandre.org
EuAndreh
.ME
and contributors.
.
.
.SH BUGS
Report bugs to the
.MT ~euandreh/$MAILING_LIST@lists.sr.ht
mailing list
.ME .
.br
Browse bugs
.UR https://$TLD/$PROJECT/TODOs.html
online
.UE .
.br
.UR https://$TLD/$PROJECT/
Home page
.UE .
.br
.UR https://lists.sr.ht/~euandreh/$MAILING_LIST?search=[$PROJECT]
Comments and discussions
.UE .
EOF

# shellcheck disable=2044
for f in $(find doc -type f -name '*.[0-9]'); do
	if ! tail -n "$(wc -l < "$EXPECTED")" "$f" | diff - "$EXPECTED"; then
		echo "Missing metadata at the end of \"$f\" file"
		if [ "$IN_PLACE" = true ]; then
			cat "$EXPECTED" >> "$f"
		else
			exit 1
		fi
	fi
done