reportist/tools/validate-all.sh

20 lines
513 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
input_dir=${1:-}
[[ -n "$input_dir" && $# -eq 1 ]] || {
echo "Usage: $0 INPUT_DIR" >&2
exit 2
}
count=0
while IFS= read -r -d '' input; do
"$root/tools/validate.sh" "$input"
((count += 1))
done \
< <(find "$input_dir" -type f \( -name '*.json' -o -name '*.yaml' -o -name '*.yml' \) -print0)
((count > 0)) || {
echo "$input_dir: no YAML or JSON reports found" >&2
exit 1
}
echo "Validated $count reports"