CLI guide: the reyin command
The binary is named reyin (crate reyin-cli). It is a scriptable tool for discovery, printing, jobs, settings and a foreground IPP server. This guide reflects the implemented WP63 slice 1; the commands below are what actually exists.
Global options
Section titled “Global options”--json machine output (one JSON document per command)--data-dir DIR manager data directory--sim use the built-in simulator provider-h, --help help-V, --version versionThe simulator provider is the only zero-hardware provider; without —sim, discovery uses the enabled transports (USB, Bluetooth, TCP) and may find nothing on a host with no printers.
Commands
Section titled “Commands”discover
Section titled “discover”reyin discover [--timeout DURATION]Lists discovered printers. —timeout accepts a duration such as 10s.
status
Section titled “status”reyin status [PRINTER]Shows status for one printer, or all printers when no printer id is given.
reyin print FILES... [--printer ID] [--copies N] [--media 4x6] [--darkness PCT] [--speed IPS] [--wait] [--timeout DURATION]Print one or more documents. —media WIDTHxLENGTH inches is required when the input
has no intrinsic media. —raw sends printer commands: the driver checks them against an
allow-list of print-content commands and refuses the whole file, with the error “raw payload
refused:
jobs and job
Section titled “jobs and job”reyin jobs [--printer ID] [--all]reyin job show JOB_IDreyin job cancel JOB_IDreyin job resume JOB_IDreyin job hold JOB_IDreyin job release JOB_IDjobs lists non-terminal jobs by default; —all includes completed/cancelled jobs.
settings
Section titled “settings”reyin settings PRINTER [--darkness PCT] [--speed IPS] [--tear-offset DOTS]With no setter flags it prints the current settings; with flags it applies them. Tracking mode (gap/mark/continuous) is deferred.
calibrate and identify
Section titled “calibrate and identify”reyin calibrate PRINTERreyin identify PRINTERcalibrate measures and sets the tear offset; identify makes the device flash/beep where the driver supports it.
reyin serve [--bind ADDR]Runs a foreground IPP server using the current manager. —hub is deferred.
automation and hooks (a running reyind)
Section titled “automation and hooks (a running reyind)”reyin automation pause | resume | statusreyin hooks statusreyin hooks check-secret NAMEreyin hooks deliveries NAME [--topic T] [--state S] [--limit N] [--cursor C]reyin hooks purge [NAME] [--before UNIX] [--yes]reyin hooks poll NAME TOPICreyin hooks quarantine NAMEreyin hooks release NAMEreyin hooks connections [NAME]These talk to reyind over its control socket (--data-dir picks the daemon) and need
[automation] enabled = true there. They create nothing in the data directory.
pause and quarantine stop things and ask nothing. resume and release start things again,
so they are meant for a person: run them at a terminal and type the word they ask for (RESUME,
RELEASE NAME). They have no --yes; in a pipe, a cron job or a script that has no terminal they
refuse (exit 1). The check is a guard against unattended use, not authentication: a program that
opens a pseudo-terminal (for example script) can answer the prompt, as with reyin batch run. purge
tells you how many pending deliveries will be dropped and will not print, and asks you to type
PURGE NAME (or PURGE ALL); a script passes --yes. Add --idempotency-key KEY to retry a
change safely: the same key acts once (a change that ends with an unknown outcome prints its key). hooks deliveries shows when, what and how big, never the
body or the headers. Exit 5 with the daemon down, 2 for an unknown connection, 1 when automation
is not enabled or the typed answer was wrong.
flow (a running reyind)
Section titled “flow (a running reyind)”reyin flow list | get ID | validate FILE | put FILE | export ID [-o FILE] | history IDreyin flow import FILE --bind connection:ALIAS=NAME --bind printer:ALIAS=ID --bind template:ALIAS=IDreyin flow approve ID --bind ...reyin flow enable ID | disable ID | delete IDreyin flow run ID [--dry | --live] [--payload FILE]reyin flow status RUN [--since-seq N] | cancel RUNreyin flow confirm-run RUN | resolve RUN retry|skipThese talk to reyind like automation and hooks and create nothing in the data directory. Flow
and payload files are read here (at most 32 KiB and 16 KiB; a larger file is refused before anything
is sent) and sent inline.
import only holds the flow and says so: nothing is stored and nothing runs until approve; enable is a separate step and refuses a flow that was never approved. A put of anything that
is not the same document as the approved stored revision (apart from its revision number and notes) is held, and the approved revision keeps running until you approve the new one: the output says it is not active and names
approve. approve shows what the held flow can do with your bindings applied (what starts it, the
printers, templates and connections, the order fields that leave the machine, the copies and notify texts, any renamed connection, the steps in order, and then the whole document)
and asks you to type the flow id; only then is it approved, and only that document. If the flow changed
while you read, nothing is approved. confirm-run (a run over a print cap) and resolve (an interrupted
run; retry can print a label twice) ask you to type the run id. None of these has a --yes, and in a
pipe or script without a terminal on input, output and error they refuse (exit 1). delete asks for the flow id, or takes --yes. A flow you imported before approval was recorded is disabled by the upgrade: export it, raise its revision by one, import it and approve it. The daemon’s token is still the boundary: a program that holds it can approve through a pseudo-terminal or a direct call.
run is a dry run unless you add --live. history shows states and times, not what an order
contained. See flows for the first-run guide.
Deferred commands
Section titled “Deferred commands”render, qr, profile, template, daemon and sim are documented in the spec (docs/crates/reyin-cli.md) but are not implemented in this slice. Do not rely on them yet.
JSON output
Section titled “JSON output”—json prints one JSON object per command result. Errors are a JSON object with error.code and error.message. Streaming commands emit JSON Lines where relevant.
Exit codes
Section titled “Exit codes”0 success1 usage error2 printer/job not found or ambiguous selection3 job failed or cancelled while waiting4 job paused (for example media empty) while waiting5 transport or permission error6 QR does not fit or verification failed10 internal errorExamples
Section titled “Examples”reyin --sim discover --jsonreyin --sim status --jsonreyin --sim print --wait --media 4x6 tests/fixtures/inputs/gradient_400x300.pngreyin --sim jobs --allreyin --sim serve --bind 127.0.0.1:8631See docs/crates/reyin-cli.md for the spec, open risks and the deferred option list.
Source: docs/guides/cli.md at fe2ada6890.