1
1
mirror of https://github.com/wader/fq.git synced 2024-11-26 21:55:57 +03:00
fq/doc/mdsh.sh
2021-09-18 18:24:12 +02:00

16 lines
379 B
Bash
Executable File

#!/bin/sh
set -eu
REPODIR=$(pwd)
TEMPDIR=$(mktemp -d)
cp -a doc/* "${TEMPDIR}"
go build -o "${TEMPDIR}/fq" main.go
for f in "$@"; do
cd "${TEMPDIR}"
echo "Generate $f"
mkdir -p "$(dirname "${TEMPDIR}/$f")"
PATH="${TEMPDIR}:${PATH}" go run "${REPODIR}/doc/mdsh.go" >"${TEMPDIR}/$f" <"${REPODIR}/$f"
mv "${TEMPDIR}/$f" "${REPODIR}/$f"
done
rm -rf "${TEMPDIR}"