1
1
mirror of https://github.com/wader/fq.git synced 2024-12-29 16:42:06 +03:00
fq/doc/mdsh.sh

20 lines
394 B
Bash
Raw Normal View History

#!/bin/sh
set -eu
FQ="$1"
shift
REPODIR=$(pwd)
2022-01-29 14:01:36 +03:00
export REPODIR
TEMPDIR=$(mktemp -d)
cp -a doc/* "${TEMPDIR}"
cp "$FQ" "${TEMPDIR}/fq"
cd "${TEMPDIR}"
for f in "$@"; do
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}"