#!/bin/sh
set -eu
cd "$(dirname "$0")"
CLI=${KICAD_CLI:-/Applications/KiCad/KiCad.app/Contents/MacOS/kicad-cli}
mkdir -p footprint_svg
"$CLI" sch export netlist --format kicadxml -o schematic/netlist.xml schematic/led_driver.kicad_sch
"$CLI" sch erc --severity-all --format json -o schematic/erc.json schematic/led_driver.kicad_sch
"$CLI" fp export svg --layers F.Cu,F.Paste,F.Mask,F.Silkscreen,F.Courtyard --output footprint_svg schematic/Lamp_Driver.pretty
python3 verify_footprints.py
