Files
murder-mystery-oneshot/prints/print.sh
2026-07-13 09:44:11 +02:00

24 lines
540 B
Bash
Executable File

#!/usr/bin/env bash
# Print a markdown file on the thermal printer.
# Usage: ./print.sh <file.md>
# PRINTER_URL env var overrides the endpoint.
set -euo pipefail
PRINTER_URL="${PRINTER_URL:-http://bard.internal:8090/print/notes?border=ornate&header=0}"
file="${1:-}"
if [[ -z "$file" ]]; then
echo "usage: $0 <file.md>" >&2
exit 1
fi
if [[ ! -f "$file" ]]; then
echo "error: no such file: $file" >&2
exit 1
fi
curl -fsS -X POST "$PRINTER_URL" \
-H "content-type: text/markdown" \
--data-binary "@$file"
echo "sent: $file"