1
1
mirror of https://github.com/wader/fq.git synced 2024-10-04 07:27:08 +03:00
fq/doc/mdsh.sh
Mattias Wadman 90c19c6cc1 make,test: Move testjq to own script and reuse fq binary
Remove version from --help for now
2021-09-19 11:50:41 +02:00

19 lines
379 B
Bash
Executable File

#!/bin/sh
set -eu
FQ="$1"
shift
REPODIR=$(pwd)
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}"