Add --output=json to ls subcommands#342
Open
miekg wants to merge 3 commits into
Open
Conversation
This PR add --output=json to _only_ the command that have an ls.go. The json keys are copied from docker and are camelCase, json struct tags are added where needed. It does _not_ change any of the inspect commands, that should be another issue. It also doesn't do any prework for future output formats, it only handles json. Fixes: psviderski#338 psviderski#337 Signed-off-by: Miek Gieben <miek@miek.nl>
Contributor
Author
|
you can't (easily) change the struct tags of generated protobufs ... these are now all in snake case. |
Signed-off-by: Miek Gieben <miek@miek.nl>
Contributor
Author
|
example for machine: and {
"Machines": [
{
"machine": {
"id": "c22073beee04bf9b1861e53c21023d2d",
"name": "machine-781l",
"network": {
"subnet": {
"ip": "10.210.0.0",
"bits": 24
},
"management_ip": "fdcc:fb07:d7f4:2509:ae43:19af:90b:1147",
"endpoints": [
"131.174.88.77:51820"
],
"public_key": "+wfX9CUJrkMZrwkLEUcyitNurEAcuki3VqTyidcsVGw="
},
"public_ip": "131.174.88.77"
},
"state": 1
},
{
"machine": {
"id": "212fd73438b53ebfb7dd531da4c6ed41",
"name": "machine-9q7y",
"network": {
"subnet": {
"ip": "10.210.1.0",
"bits": 24
},
"management_ip": "fdcc:7911:76ad:b00c:9f0e:5ed4:9b81:ee70",
"endpoints": [
"131.174.88.78:51820"
],
"public_key": "eRF2rbAMnw5e1JuB7nCwxYMaH1lsoMMwuS63c+Dm9lI="
},
"public_ip": "131.174.88.78"
},
"state": 1
}
]
} |
Contributor
Author
|
as |
Contributor
Author
|
and volume for instance - different keys: dont know how much this actually matter in json actualy... Well is does matter. Adding a post-process json function is very easy, so we could rewrite all the keys into a way to makes it all more consistent |
Signed-off-by: Miek Gieben <miek@miek.nl>
This was referenced Apr 30, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR add --output=json to only the command that have an ls.go. The json keys are copied from docker and are camelCase, json struct tags are added where needed.
It does not change any of the inspect commands, that should be another issue. It also doesn't do any prework for future output formats, it only handles json.
Fixes: #338 #337