Output Formats

Three output formats. Choose with -o, --output or set output = "json" in config.

Format TTY (interactive) Pipe / file (non-TTY) Use it for
(auto) Aligned colored table TSV (tab-separated) Default — works in both modes
table Same as auto TSV Force aligned output
json Pretty-printed JSON (2-space indent) Same Pipelines with jq, snapshots
yaml YAML Same Diff-friendly snapshots

TTY-aware default

When stdout is a real terminal, autocom orders list produces an aligned, colored table:

ORDER             STATUS    TOTAL    CURRENCY  CREATED
─────────────     ───────   ──────   ────────  ─────────────────────
ORD-20260503-001  pending   2999.00  INR       2026-05-03T10:14:22Z
ORD-20260503-002  shipped   1499.50  INR       2026-05-03T11:22:45Z

When stdout is a pipe or a file, the same command emits TSV:

ORDER	STATUS	TOTAL	CURRENCY	CREATED
ORD-20260503-001	pending	2999.00	INR	2026-05-03T10:14:22Z
ORD-20260503-002	shipped	1499.50	INR	2026-05-03T11:22:45Z

That's so existing UNIX pipelines work without quoting:

autocom orders list | awk -F'\t' '$2 == "pending" {print $1}'
autocom orders list | column -t -s$'\t'        # re-pretty if you want

JSON

autocom orders list -o json
[
  {
    "id": "01H...",
    "order_number": "ORD-20260503-001",
    "status": "pending",
    "total": 2999.00,
    "currency": "INR",
    "created_at": "2026-05-03T10:14:22Z"
  }
]

# Pipe through jq
autocom orders list -o json | jq '[.[] | select(.status == "pending")] | length'
autocom orders list -o json | jq -r '.[].order_number'

JSON output is exactly what the GraphQL response data envelope contains — no extra wrapping. Empty results produce [], not null.

YAML

autocom orders list -o yaml
---
- id: 01H...
  order_number: ORD-20260503-001
  status: pending
  total: 2999.00
  ...

Useful for snapshots that go into version control — diff-friendly, easy to read in PR review.

Color

ANSI styling activates only when stdout is a TTY AND NO_COLOR is unset. Two ways to opt out:

autocom orders list --no-color           # per-command
NO_COLOR=1 autocom orders list           # session-wide

NO_COLOR=1 follows the no-color.org convention — most modern CLIs (gh, kubectl, terraform) honor it, so set it once in your shell rc.

Combining with shell tools

# Most-recent failed order
autocom orders list --status failed -o json | jq '.[0]'

# Cancel every pending order older than 1 hour (dry-run via jq filter first)
autocom orders list --status pending -o json \
  | jq -r '.[] | select((now - (.created_at | fromdateiso8601)) > 3600) | .id' \
  | xargs -I {} autocom orders cancel {} --reason "auto-clean stale pending"

# Snapshot a tenant's settings into git
autocom api query '{ settings { all } }' -o yaml > snapshots/settings.yaml
git add snapshots/settings.yaml

Quirks

  • autocom version -o json currently ignores the format flag and always prints the human form. Tracked as a v1.0.1 bug fix.
  • autocom api query always emits the raw GraphQL envelope (data + errors + extensions), regardless of -o — that's deliberate so you can inspect errors and pipe through jq.
  • autocom whoami -o yaml falls back to a JSON-ish rendering — full YAML support is a v1.1 line item; for now it's good enough to read but not a strict YAML 1.2 emitter.

Empty results

Format Empty rendering
Table (TTY) Header + (no rows) line
Table (TSV) Header line only
JSON [] or {} depending on operation
YAML --- [] or --- {}

Quoting in shell pipelines

autocom api query accepts the query as a positional arg — single quotes prevent the shell from interpreting $variables:

autocom api query 'mutation { _ping }'                      # ✓ single quotes
autocom api query "mutation { \$id }"                       # ⚠️ double quotes need escaping

Heredoc is cleaner for multi-line queries:

autocom api query --stdin <<'GQL'
query OrdersByCustomer($cid: ID!) {
  orders_list(input: { customer_id: $cid, limit: 100 })
}
GQL  -V '{"cid":"cust_abc"}'

The single-quoted heredoc delimiter (<<'GQL') prevents shell expansion inside the body.