add manpage builder

This commit is contained in:
Simon Vieille 2024-07-29 12:11:02 +02:00
commit cdb98adcd3
3 changed files with 32 additions and 1 deletions

14
bin/create-manpage.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
(
printf ".TH expiration-check 1 \"%s\" \"Manual of expiration-check\"\n" "$(date +'%Y-%m-%d')"
printf ".LO 1\n"
./build/expiration-check-linux-amd64 -h \
| sed -E 's/^([A-Z ]+):$/.SH \1/g' \
| sed -E 's/^ (.+) (.+)/.TP\n.B \1\n\2\n\n/g' \
| sed -E 's/^ (\w+)/\1/g' \
| sed -E 's/\\{0}-([a-z]+)/\\-\1/g' \
| sed -E 's/-\\-/\\-\\-/g' \
| sed -E 's/\s+$//g'
) | gzip -9 > ./build/expiration-check.1.gz