Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nscale.com/llms.txt

Use this file to discover all available pages before exploring further.

Extract a single field

Get just the IDs from a list response:
nscale instances list -q ".[].metadata.id"
Each filter result is printed on its own line, so the output flows naturally into shell loops:
for id in $(nscale instances list -q ".[].metadata.id"); do
  nscale instances stop --id "$id" --yes
done

Reshape the output

Filters can transform the response into a new structure. The following collects each instance’s id and name into a single array:
nscale instances list -q "[.[] | {id: .metadata.id, name: .metadata.name}]"
[
  {"id":"bed4405e-bd2f-491a-a515-3612e6d4230f","name":"instance-1"},
  {"id":"f1facb11-d3de-417f-92c0-dc582cea4c80","name":"instance-2"}
]

Combine with an external jq

The output of -q is still valid JSON when the filter produces JSON, so you can pipe it into jq (or any other JSON-aware tool) for further processing:
nscale projects list -q "[.[] | {id: .metadata.id, groupIDs: .spec.groupIDs}]" | jq "[.[] | .id]"

Multiple filters

-q can be repeated. Each filter’s results are zipped column-wise (space-separated per line), which is handy for tabular output:
nscale instances list -q ".[].metadata.id" -q ".[].metadata.name"
bed4405e-bd2f-491a-a515-3612e6d4230f instance-1
f1facb11-d3de-417f-92c0-dc582cea4c80 instance-2
Iteration stops at the shortest stream; a warning is emitted on stderr when a later filter runs out first.