Allow --format=json
as an alias of --format={{json .}}
#3355
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.
- What I did
Allow
--format=json
as an alias of--format={{json .}}
for convenience.- How I did it
Updated
templates.NewParse
- How to verify it
Before:
After:
$ docker image inspect alpine --format=json {"Id":"sha256:14119a10abf4669e8cdbdff324a9f9605d99697215a0d21c360fe8dfa8471bab","RepoTags":["alpine:latest"],"RepoDigests":["alpine@sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a"],"Parent":"","Comment":"","Created":"2021-08-27T17:19:45.758611523Z","Container":"330289c649db86f5fb1ae5bfef18501012b550adb0638b9193d4a3a4b65a2f9b","ContainerConfig":{"Hostname":"330289c649db","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"/bin/sh\"]"],"Image":"sha256:d3e0b6258ec2f725c19668f11ae5323c3b0245e197ec478424ec6a87935690eb","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"DockerVersion":"20.10.7","Author":"","Config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh"],"Image":"sha256:d3e0b6258ec2f725c19668f11ae5323c3b0245e197ec478424ec6a87935690eb","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"Architecture":"amd64","Os":"linux","Size":5595292,"VirtualSize":5595292,"GraphDriver":{"Data":{"MergedDir":"/var/lib/docker/overlay2/f2ce81000bfa11a765bf1774978ec5f257aa66c250024fd50e9f5e2ee33043a0/merged","UpperDir":"/var/lib/docker/overlay2/f2ce81000bfa11a765bf1774978ec5f257aa66c250024fd50e9f5e2ee33043a0/diff","WorkDir":"/var/lib/docker/overlay2/f2ce81000bfa11a765bf1774978ec5f257aa66c250024fd50e9f5e2ee33043a0/work"},"Name":"overlay2"},"RootFS":{"Type":"layers","Layers":["sha256:e2eb06d8af8218cfec8210147357a68b7e13f7c485b991c288c2d01dc228bb68"]},"Metadata":{"LastTagTime":"0001-01-01T00:00:00Z"}}
- Description for the changelog
Allow
--format=json
as an alias of--format={{json .}}
- A picture of a cute animal (not mandatory but encouraged)
🐧
Podman seems already implemented the same syntax
https://github.com/containers/common/blob/850904b0be9c4960a83acf077e34acc7857312bf/pkg/report/validate.go#L5