Output formats and piping
Every command takes --format. Pick json when something will parse it, table when you
will read it, and ids when the output feeds the next command.
lazydap stack --format json | jq '.frames[0].line'With no --format, lazydap chooses: table when stdout is a terminal, json everywhere
else. So a pipeline gets JSON without asking, and a human gets columns without asking.
The five
Section titled “The five”json — the contract
Section titled “json — the contract”One object or array. The schema is stable and breaking it costs a decision-log entry.
$ lazydap variables --reference 1003 --format json{ "variables": [ { "name": "n", "type_name": "int", "value": "10", "variables_reference": 0 }, { "name": "sum", "type_name": "int", "value": "21", "variables_reference": 0 }, { "name": "i", "type_name": "int", "value": "7", "variables_reference": 0 } ]}table — not a contract
Section titled “table — not a contract”$ lazydap variables --reference 1003 --format tableNAME VALUE TYPE REFERENCEn 10 int 0sum 21 int 0i 7 int 0Column order and widths change whenever they read badly. Do not parse this. If you are
reaching for awk here, you want --format json or --format csv.
jsonl — one object per line
Section titled “jsonl — one object per line”For streams and while read. Arrays come out as one element per line rather than one blob:
$ lazydap stack --format jsonl{"column":16,"id":1010,"line":6,"name":"total","source":{"name":"hello.c","path":"/Users/you/lazydap-demo/hello.c"}}{"column":18,"id":1011,"line":14,"name":"main","source":{"name":"hello.c","path":"/Users/you/lazydap-demo/hello.c"}}{"column":0,"id":1012,"line":1751,"name":"start","source":{"name":"@start","source_reference":1000}}csv — for spreadsheets and cut
Section titled “csv — for spreadsheets and cut”$ lazydap stack --format csvframe,name,source,line1007,total,/Users/you/lazydap-demo/hello.c,61008,main,/Users/you/lazydap-demo/hello.c,141009,start,@start,1751A flattened view, so nested fields are dropped rather than escaped. Use json when you need
all of it.
ids — bare ids for xargs
Section titled “ids — bare ids for xargs”$ lazydap break --list --format ids1One id per line, nothing else. This is the format that makes commands compose.
Piping between commands
Section titled “Piping between commands”--id is repeatable and reads exactly what --format ids writes:
lazydap break --list --format ids | xargs -I{} lazydap break --remove --id {}Preview it first. Every mutation takes --dry-run and reports the same selection the real run
would act on:
lazydap break --remove --all --dry-run --format jsonlazydap break --remove --allxargs -r is GNU-only and does nothing on macOS. When an empty list is possible, guard it:
ids=$(lazydap break --list --format ids)[ -n "$ids" ] && printf '%s\n' "$ids" | xargs -I{} lazydap break --remove --id {}Reading a --wait reply with jq
Section titled “Reading a --wait reply with jq”result=$(lazydap continue --wait --format json)
printf '%s' "$result" | jq -r .stateprintf '%s' "$result" | jq -r '.frame | "\(.source.name):\(.line) in \(.name)"'printf '%s' "$result" | jq -r '.captured_output[] | select(.category=="stdout") | .output'The last one is the program’s own output, separated from the adapter’s console chatter.
Errors
Section titled “Errors”Errors go to stderr as JSON, and stdout stays empty. So a pipeline that parses stdout does not get an error object where it expected data:
$ lazydap variables --ref 1006 --format json{"details":{"kind":"UnknownArgument"},"error":"UsageError","message":"error: unexpected argument '--ref' found\n\n tip: a similar argument exists: '--reference'\n\nUsage: lazydap variables --reference <REFERENCE>\n\nFor more information, try '--help'."}$ echo $?2The exit code is the signal to branch on. Errors and exit codes lists all of them.
See also
Section titled “See also”- JSON output — field-by-field schemas
lazydap break— selection flags in full- Debug with an agent — the same formats, from a model