76 lines
2.2 KiB
Bash
Executable File
76 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage:
|
|
./beffroi.sh report INPUT OUTPUT.pdf [Reportist options]
|
|
./beffroi.sh diagnostic-pdf DIAGNOSTIC.json OUTPUT.pdf
|
|
./beffroi.sh capture-pdf CAPTURE OUTPUT.pdf
|
|
./beffroi.sh diagnostic CAPTURE EVIDENCE_ROOT OUTPUT_DIR REFERENCE_TIME TITLE AUTHOR DATE
|
|
./beffroi.sh all OUTPUT_DIR [--include-json] [--replace]
|
|
./beffroi.sh package BUILD_DIR ARTIFACT_DIR
|
|
./beffroi.sh test
|
|
./beffroi.sh bootstrap
|
|
./beffroi.sh doctor
|
|
EOF
|
|
exit "${1:-0}"
|
|
}
|
|
|
|
require() {
|
|
local missing=() command
|
|
for command in "$@"; do command -v "$command" >/dev/null 2>&1 || missing+=("$command"); done
|
|
((${#missing[@]} == 0)) || { echo "Missing tools: ${missing[*]}" >&2; exit 1; }
|
|
}
|
|
|
|
command_name=${1:-help}; shift || true
|
|
case "$command_name" in
|
|
report)
|
|
(($# >= 2))||usage 2; require typst
|
|
report_input=$1; report_output=$2; shift 2
|
|
reporter/render.sh "$report_input" --output "$report_output" "$@"
|
|
;;
|
|
diagnostic-pdf)
|
|
[[ $# -eq 2 ]]||usage 2; require typst
|
|
reports/plugins/diagnostics/tools/validate.sh "$1" >/dev/null
|
|
reporter/render.sh "$1" --plugin reports/plugins/diagnostics \
|
|
--plugin-input "author=${DIAGNOSTICS_AUTHOR:-Beffroi}" \
|
|
--plugin-input "theme=${DIAGNOSTICS_THEME:-default}" --output "$2"
|
|
;;
|
|
capture-pdf)
|
|
[[ $# -eq 2 ]]||usage 2; require git typst
|
|
scripts/render-capture.sh "$1" "$2"
|
|
;;
|
|
diagnostic)
|
|
[[ $# -eq 7 ]]||usage 2; require git typst
|
|
scripts/workflow.sh all "$@"
|
|
;;
|
|
all)
|
|
(($# >= 1))||usage 2; require git typst
|
|
scripts/build-publication.sh "$@"
|
|
;;
|
|
package)
|
|
[[ $# -eq 2 ]]||usage 2; require uv
|
|
scripts/package-reports.sh "$1" "$2"
|
|
;;
|
|
test)
|
|
[[ $# -eq 0 ]]||usage 2; require git typst uv
|
|
scripts/check-components.sh
|
|
;;
|
|
bootstrap)
|
|
[[ $# -eq 0 ]]||usage 2; require git typst
|
|
./bootstrap.sh
|
|
;;
|
|
doctor)
|
|
[[ $# -eq 0 ]]||usage 2
|
|
require git typst
|
|
echo "Core tools are available."
|
|
for optional in uv; do
|
|
if command -v "$optional" >/dev/null 2>&1; then "$optional" --version 2>/dev/null | head -n 1 || true; else echo "Optional tool missing: $optional"; fi
|
|
done
|
|
;;
|
|
help|-h|--help) usage 0;;
|
|
*) usage 2;;
|
|
esac
|