#!/usr/bin/env bash
#
# Wrapper for a locally patched UVtoolsCmd build that provides the
# native `pcb-expose` command (see pcb-expose.patch).
#
# Usage:
#   pcb-expose-patched.sh <dummy-file> <gerber-files...> [options]
#
# Example:
#   pcb-expose-patched.sh Dummy.pm4n \
#       Board-F.Cu.gtl \
#       --invert --mirror --exposure 120 \
#       --output Board-F.Cu.pm4n
#
# Configure the path to your patched build below, or override via:
#   UVTOOLSCMD=/path/to/UVtoolsCmd pcb-expose-patched.sh ...

set -euo pipefail

UVTOOLSCMD="${UVTOOLSCMD:-$HOME/proj/UVtools/publish/UVtoolsCmd}"

if [ ! -x "$UVTOOLSCMD" ]; then
    echo "Error: UVtoolsCmd not found or not executable at: $UVTOOLSCMD" >&2
    echo "Set UVTOOLSCMD=/path/to/UVtoolsCmd or edit this script." >&2
    exit 1
fi

exec "$UVTOOLSCMD" pcb-expose "$@"
