#!/usr/bin/env bash # Print a markdown file on the thermal printer. # Usage: ./print.sh # 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 " >&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"