Scripting & output
The CLI is built to drop into shell scripts and CI pipelines. You choose how output is rendered, narrow it to the fields you care about, branch on a meaningful exit code when something fails, and feed request bodies in from a file or a pipe. For running the CLI headless with a token, see non-interactive use.
Choose an output format
Pick a renderer with -o, --output <format>. The default, table, is tuned for reading at a terminal; the rest are stable, uncolored, and safe to pipe.
| Format | Alias flag | Use it for |
|---|---|---|
table | — | Human-readable, aligned columns; adapts to the terminal width. The default. |
json | --json, -j | Byte-stable, uncolored JSON for piping to jq. |
jsonl (ndjson) | --jsonl | JSON Lines — one compact record per line, for streaming large lists into jq -c, xargs, or log pipelines. |
csv | --csv | RFC 4180 rows — a header line plus one line per record. |
yaml | --yaml | Losslessly structured YAML. |
markdown (md) | --markdown, --md | GitHub-flavored Markdown table — handy for docs, PR comments, and issues. |
revenexx products get <id> -o json | jq .status
revenexx products list --jsonl | jq -r '.id'
revenexx orders list -o csv > orders.csv
revenexx products list --md --fields id,name,status >> report.md
--json (and -o json) stays byte-stable so it never breaks a downstream parser: no color, no progress chrome, just the JSON.
Select fields
Narrow the output to the columns you need with --fields, a comma-separated list. On a list response it projects the columns of the returned collection; on a single record it keeps just those keys:
revenexx products list -o csv --fields id,name,createdAt
revenexx products get <id> -o json --fields id,status
On a terminal, every format prompts for any missing required option. When the output is piped (non-TTY), the command fails fast instead of hanging — so a script never blocks on a prompt it can't answer.
Errors and exit codes
Under --json/-o json or --quiet, a failure is written to stderr as a structured object and the process exits with a code that tells you why it failed:
{ "error": { "message": "...", "code": 404, "type": "...", "requestId": "..." } }
| Exit code | Meaning |
|---|---|
0 | Success |
2 | Usage error (bad flags or arguments) |
4 | Authentication or authorization failure (401 / 403) |
5 | Not found (404) |
8 | Rate limited (429) |
1 | Generic failure (network, timeout, 5xx, and everything else) |
--quiet opts into structured errors and exit codes without committing to a particular stdout format — useful when you only care whether a command succeeded, or want to pair it with a non-JSON renderer.
if ! revenexx --quiet products get "$id" > /dev/null; then
case $? in
4) echo "not authenticated" ;;
5) echo "no such product" ;;
8) echo "rate limited — back off and retry" ;;
*) echo "request failed" ;;
esac
fi
Request bodies from a file or stdin
Create and update commands accept a JSON body inline, from a file with @path, or from stdin with -, via --data. That lets you round-trip a resource — read it, edit it, send it back:
# Edit-in-place round-trip
revenexx products get "$id" -o json > product.json
# edit product.json …
revenexx products update "$id" --data @product.json
# Or straight through a pipe
jq '.name = "Renamed"' product.json | revenexx products update "$id" --data -
Explicit flags override matching keys from --data, so you can reuse a base body and change one value:
revenexx products update "$id" --data @product.json --name "New name"
Example: report active products in CI
- name: Report active products
env:
REVENEXX_API_KEY: ${{ secrets.REVENEXX_API_KEY }}
REVENEXX_TENANT: acme
REVENEXX_API_URL: https://api.revenexx.com
run: |
npm install -g @revenexx/cli
revenexx products list --md --fields id,name,status >> "$GITHUB_STEP_SUMMARY"
What's next
- Run the CLI headless with a token — non-interactive use.
- Browse every command and its flags in the command reference.
- Keep generated code current with type generation.