yq/scripts/genman.sh

28 lines
645 B
Bash
Raw Normal View History

2021-10-14 22:51:42 +00:00
#! /bin/bash
set -e
# note that this reqires pandoc to be installed.
cat ./pkg/yqlib/doc/headers/Main.md > man.md
printf "\n# HOW IT WORKS\n" >> man.md
cat ./pkg/yqlib/doc/aa.md >> man.md
for f in ./pkg/yqlib/doc/*.md; do
docNameWithExt="${f##*/}"
docName="${docNameWithExt%.*}"
docNameCap=$(echo $docName | tr [a-z] [A-Z])
if [ "$docName" != "aa" ]; then
printf "\n\n# ${docNameCap}\n" >> man.md
cat "$f" >> man.md
fi
done
2021-10-14 23:39:33 +00:00
header=$(./yq --version)
pandoc \
--variable=title:"YQ" \
--variable=section:"1" \
--variable=author:"Mike Farah" \
--variable=header:"${header}" \
--standalone --to man man.md -o yq.1