a minimal cli for printing smaller world posts with a receipt printer.
- Go via
mise(e.g.mise install go) - System printing tools (
lp,lpstat) if you want to send to a printer - Playwright will download Chromium on first run (cached under
~/Library/Caches/ms-playwright-goor~/.cache/ms-playwright-go)
cd postprint
mise exec -- go build -o postprint./postprint [--debug] [--local]- you'll first choose a mode:
- "Watch a space (print new posts as they arrive)"
- "Print a single post (by ID)"
- for a space, enter either:
- The friendly ID (
some-name-abcdef0123456789abcdef0123456789) - The raw UUID (with or without dashes)
- The full space URL (uses its host; otherwise defaults to
https://smallerworld.club)
- The friendly ID (
- for a post, enter the post ID (posts don't have public URLs).
then you'll pick how to output:
- default: "save to downloads only" (always saves to
~/Downloads) - Or pick a printer from
lpstat -p(PDF still saved to~/Downloads)
- hosts allowed:
smallerworld.cluborlocalhost(for local dev). - override the default base with
--local(useshttp://localhost:3000when the space input isn't a URL). - printing uses
lp -o media=Custom.{width}x{height}mm -o fit-to-pagewith dynamic dimensions derived from the rendered.PostCard. - space polling interval: 1s. it tracks seen post IDs and creation timestamps to avoid duplicates.
