Skip to content
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

Allow --format=json as an alias of --format={{json .}} #3355

Closed
wants to merge 1 commit into from

Conversation

AkihiroSuda
Copy link
Collaborator

@AkihiroSuda AkihiroSuda commented Nov 1, 2021

- 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:

$ docker image inspect alpine --format=json
json

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

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@codecov-commenter
Copy link

Codecov Report

Merging #3355 (1870ede) into master (e57b5f7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3355   +/-   ##
=======================================
  Coverage   58.01%   58.01%           
=======================================
  Files         302      302           
  Lines       21762    21764    +2     
=======================================
+ Hits        12625    12627    +2     
  Misses       8215     8215           
  Partials      922      922           

@thaJeztah
Copy link
Member

Looks like this is the same / similar to #2936 (but there were some pending review comments on that one)

/cc @silvin-lubecki

@AkihiroSuda
Copy link
Collaborator Author

Ah, didn’t notice… 😅

@AkihiroSuda AkihiroSuda closed this Nov 1, 2021
@thaJeztah
Copy link
Member

Perhaps someone needs to carry that one if @silvin-lubecki doesn't have time though 😅

@silvin-lubecki
Copy link
Contributor

Yes please, I don't think I will be able to allocate time on it 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants