reportist/tools/validate.sh

16 lines
460 B
Bash
Executable File

#!/usr/bin/env bash
# Validate only what the report plugin itself requires to render.
set -euo pipefail
[[ $# -eq 1 ]] || {
echo "Usage: $0 INPUT" >&2
exit 2
}
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
stage=$(mktemp -d "${TMPDIR:-/tmp}/beffroi-report-validate.XXXXXXXX")
trap 'rm -rf -- "$stage"' EXIT
"$root/render.sh" "$1" --output "$stage/report.pdf" >/dev/null || {
echo "error: invalid report" >&2
exit 1
}
echo "Valid report: $1"