Option for json output for CLI
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 43
Description
#### Feature Description
A global `-out [table|json]` option to modify the commands output from the current "table" to json
```
consul info -out json
{ "agent": {
"check_monitors": 0,
"check_ttls": 0,
"checks": 5,
...
```
or
```
consul acl token list
[
{
"AccessorID": "49f6bd35-0cc6-8acc-ee71-2ccfe8c57161",
"Description": "client service token",
"Local": "false",
"Create Time": "2019-05-27 11:28:40.321670815 +0000 UTC",
"Legacy": "false",
"Policies": {
{
"AccessorID": "c4a6823e-62b0-1740-ea4a-1eef83988669",
"Description": "client-service-policy"
}
}
},
...
]
```
#### Use Case(s)
consul CLI is very convenient for a bit of bash scripting, when one doesn't wan't to curl everything. One annoying bit is the "human readable" output, which need to be parsed to be exploitable. The good ol' `| grep | awk` and so on. But it's unreliable on the long term. Adding a "machine readable" output like json would allow using jq for a more sustainable result
Contributor guide
Assessment
This issue has not been assessed yet.