#!/bin/bash

set -e

filename=$(basename -- "$1")
filename="${filename%.*}"

kicad-cli pcb export gerbers -o output -l Back $1
kicad-cli pcb export gerbers -o output -l Edge.Cuts $1
kicad-cli pcb export drill -o output $1

mkdir -p gcode

docker run --rm -i -t -u "$(id -u):$(id -g)" -v ".:/data" ptodorov/pcb2gcode \
	--back="output/$filename-Back.gbl" \
	--drill="output/$filename.drl" \
	--outline="output/$filename-Edge_Cuts.gm1"

