-
Notifications
You must be signed in to change notification settings - Fork 745
Change limactl list --format json not to include empty objects
#4032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b392b94 to
a1f452d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it only changes the output format for TTY - then it should be OK
Still works for users like lima-gui, so invalid
The change to show pretty-printed JSON for TTY output only was already in #3998. This PR is only removing empty objects from the JSON output to make it identical to the YAML output. The good thing is we have tests now to make sure the output stays in JSON Lines format when written to a pipe or file. |
Unlike the YAML encoder, the JSON encoder will encode empty structs
even when they have the `json:",omitempty"` tag (it will only emit nil
pointers to structs).
This commit repeatedly removes empty objects until the result no
longer gets any shorter. It doesn't check for the omitempty tag, but
we have that tag set on every struct.
Example: this removes `"vmOpts":{"qemu":{},"vz":{"rosetta":{}}}`.
Signed-off-by: Jan Dubois <[email protected]>
Always put --format at the end of the command to make it easier to spot the difference between the commands. Signed-off-by: Jan Dubois <[email protected]>
a1f452d to
7a7795a
Compare
AkihiroSuda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Unlike the YAML encoder, the JSON encoder will encode empty structs even when they have the
json:",omitempty"tag (it will only emit nil pointers to structs).This commit repeatedly removes empty objects until the result no longer gets any shorter. It doesn't check for the omitempty tag, but we have that tag set on every struct.
Example: this removes
"vmOpts":{"qemu":{},"vz":{"rosetta":{}}}.