Skip to content

Output Formatting

The --output Flag

All commands that return structured data accept --output (alias -o):

Value Description
table Human-readable table (default)
json Raw JSON — byte-identical to the API response
yaml YAML
tsv Tab-separated values — ideal for shell pipelines
phyware cloud events list --output json
phyware cloud tenants list --output yaml
phyware users list --output tsv

Filtering with jq

# Extract all event IDs
phyware cloud events list -o json | jq '[.events[].id]'

# Get a specific field from a tenant
phyware cloud tenants get ten_abc123 -o json | jq '.tenant.name'

# Filter events by source
phyware cloud events list -o json | jq '[.events[] | select(.source_id == "src_xyz")]'

TSV Pipelines

# List tenants → extract name column → sort
phyware cloud tenants list -o tsv | cut -f2 | sort

# Count active violations
phyware comp violations list -o tsv | wc -l

Pretty-printing YAML

phyware cloud sources list -o yaml | less

Machine-readable Catalog

# Discover all commands as JSON
phyware commands catalog -o json

# List command names only
phyware commands catalog -o tsv | cut -f1

# Find all commands in a group
phyware commands catalog -o json | jq '[.commands[] | select(.group == "cloud") | .name]'