Scripting & output

Make the revenexx CLI a first-class automation citizen — choose an output format (JSON, JSON Lines, CSV, YAML, Markdown), project fields, branch on meaningful exit codes, and feed request bodies from a file or stdin.

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.

FormatAlias flagUse it for
tableHuman-readable, aligned columns; adapts to the terminal width. The default.
json--json, -jByte-stable, uncolored JSON for piping to jq.
jsonl (ndjson)--jsonlJSON Lines — one compact record per line, for streaming large lists into jq -c, xargs, or log pipelines.
csv--csvRFC 4180 rows — a header line plus one line per record.
yaml--yamlLosslessly structured YAML.
markdown (md)--markdown, --mdGitHub-flavored Markdown table — handy for docs, PR comments, and issues.
Shell
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:

Shell
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:

JSON
{ "error": { "message": "...", "code": 404, "type": "...", "requestId": "..." } }
Exit codeMeaning
0Success
2Usage error (bad flags or arguments)
4Authentication or authorization failure (401 / 403)
5Not found (404)
8Rate limited (429)
1Generic 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.

Shell
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:

Shell
# 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:

Shell
revenexx products update "$id" --data @product.json --name "New name"

Example: report active products in CI

.github/workflows/report.yml
- 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

Was this page helpful?