Normalize JSON and JSONL output
This commit is contained in:
parent
3c84713472
commit
116a431a12
5 changed files with 276 additions and 191 deletions
|
|
@ -4,6 +4,12 @@ These examples are intended as starting points for local scripts and
|
|||
infrastructure automation. They assume the single `geth` executable is on
|
||||
`PATH`.
|
||||
|
||||
Use `--json` when one process invocation produces one result that will be
|
||||
parsed as a complete document. Use `--jsonl` for line-oriented shell pipelines:
|
||||
each current command writes one compact object on one physical line. The flags
|
||||
are mutually exclusive, and failures use the same `type: "error"` envelope and
|
||||
return a nonzero exit status in either mode.
|
||||
|
||||
## Shell
|
||||
|
||||
Initialize a home, start the daemon in a user-owned process, wait for control,
|
||||
|
|
@ -25,6 +31,13 @@ geth doctor --json
|
|||
geth status --json
|
||||
```
|
||||
|
||||
For a compact line suitable for an append-only log or `jq -c` pipeline:
|
||||
|
||||
```sh
|
||||
geth status --jsonl >>geth-status.jsonl
|
||||
tail -n 1 geth-status.jsonl | jq -r '.type'
|
||||
```
|
||||
|
||||
Create a backup into a separate directory and validate that it can restore to a
|
||||
new home:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue