WireProto/.githooks/pre-commit/01-docgen

24 lines
406 B
Plaintext
Raw Permalink Normal View History

2024-07-07 23:33:21 -04:00
#!/bin/bash
2024-07-07 23:35:32 -04:00
#docsdir="${PWD}/docs"
docsdir="${PWD}"
2024-07-07 23:33:21 -04:00
if ! command -v asciidoctor &> /dev/null;
then
exit 0
fi
mkdir -p "${docsdir}"
for f in $(find . -maxdepth 1 -type f -iname "*.adoc"); do
filename=$(basename -- "${f}")
nosuffix="${filename%.*}"
asciidoctor \
-a allow-uri-read \
-o "${docsdir}/${nosuffix}.html" \
"${f}"
git add "${docsdir}/${nosuffix}.html"
done
echo "Regenerated docs"