Files
uberbringer/docs/cli.md
T
57_WolveandClaude Opus 5.5 9e829bfce7 Take a module route's copies and printer in its JSON body
API inputs go in the JSON body, never in query parameters (owner,
2026-12-01; design.md, "Inputs go in the JSON body"). The module routes
took copies and printer in the query, beside a body that was the
module's payload alone.

The body of POST /api/v1/print/{module} and /api/v1/preview/{module}
now holds the payload under payload, with copies and printer beside it:
{"payload": {...}, "copies": 2, "printer": "default"}. A module may name
its payload's fields as it likes, since none can collide with copies or
printer; that matters for ntfy's messages and for any module that takes
another system's JSON. The body is decoded strictly, and its problems
are answered at once as invalid_payload, each named by its path in the
body: copies, or, once the body is right, payload.done[0] for one the
module finds. A field named body is quoted, "body", so it is never
taken for a problem with the whole body. copies takes 0-5, as a job's
does, 0 meaning one. A query string on these routes gets 400
invalid_query, now worded "query parameters are not accepted".

The ntfy client recipes in docs/api.md wrap $NTFY_RAW in the body. The
Windows command was run here through cmd.exe and PowerShell, and the
printf of the Linux one in sh, each with a message holding quotes, & and
%; neither ran under an ntfy client. No tag carries the module query, so
the 0.2.0 entries in the CHANGELOG change in place (owner, 2026-12-01).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 22:29:02 -06:00

70 lines
3.0 KiB
Markdown

# Command line
```text
uberbringer [--config config.toml] run the daemon (default command)
uberbringer secret print a new random API secret
uberbringer token [--subject s] [--ttl 720h] print a signed bearer token
[--modules ntfy,notify] [--raw] ... limited to modules, or able to print raw ESC/POS
uberbringer preview [file.json|-] show the lines a job would print
uberbringer preview --module note [file|-] show the receipt a module builds
uberbringer config get <key> print one setting, e.g. webserver.port
uberbringer version print the version
uberbringer licenses print the licenses of the third-party software
```
Every command that reads the config takes `--config` (`-c`);
[configuration.md](configuration.md#loading) gives its default and how to
run without a file.
## The daemon
`uberbringer` with no command runs the daemon. It shuts down gracefully on
SIGINT/SIGTERM. With [`state.dir`](configuration.md#state), a receipt
already being written to the printer is finished, and every job that has
sent nothing yet stays queued and prints after the next start. Without
it, a receipt that is already printing is finished, and jobs still
waiting are marked failed.
## secret
`secret` prints a new random secret for `api.secret`.
## token
`token` prints a bearer token signed with `api.secret`. `--subject` names
the client (default `uberbringer`), and `--ttl` sets how long the token
lasts; without it, the token never expires. Without the scope flags, a
token may use every route but cannot print jobs with `raw` elements:
- `--raw` lets it print them.
- `--modules ntfy,notify` limits it to those modules' print and preview
routes, job status and the module list. The names must be modules the
daemon has, and `--raw` cannot be added.
[security.md](security.md#issuing-tokens) says which token to give which
client and how to keep it off command lines.
## preview
`preview` reads a job from the file, or from standard input with `-` or no
argument, and lays it out for the printer in the config, as
`/api/v1/preview` does. It prints nothing and fetches no images. On a
terminal it shows bold, underlined and inverted text as such; warnings go
to standard error. With `--module`, the input is that module's payload, as
the `payload` field of a `/api/v1/print/:module` body holds it, built at
the time now. It reads the same config as the daemon, so `api.secret` and
`printer.address` must be set even though neither is used.
## config get
`config get` prints a setting as the daemon would use it, from the file,
`UBERBRINGER_*` variables and the defaults, and fails when the configuration
does not load. Durations print as `15s`, lists comma-separated, and tables
as sorted `name=value` entries. It never prints `api.secret`.
## version and licenses
`version` prints the version. `licenses` prints the license and notice
texts of the third-party software in the binary, the same text as
[THIRD-PARTY-LICENSES.md](../THIRD-PARTY-LICENSES.md).