Modify kpod diff --json to --format json
We want all kpod subcommands to use the formats code to output formats like json. Altering kpod diff --json to kpod diff --format json like the kpod images command. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
parent
f82fe5691a
commit
78c6151519
13 changed files with 267 additions and 237 deletions
|
@ -33,7 +33,7 @@ var (
|
|||
},
|
||||
cli.StringFlag{
|
||||
Name: "format",
|
||||
Usage: "Change the output format.",
|
||||
Usage: "Change the output format to JSON or a Go template",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "filter, f",
|
||||
|
@ -160,10 +160,10 @@ func outputImages(store storage.Store, images []storage.Image, truncate, digests
|
|||
var out formats.Writer
|
||||
|
||||
switch outputFormat {
|
||||
case "json":
|
||||
out = formats.JSONstruct{Output: toGeneric(imageOutput)}
|
||||
case formats.JSONString:
|
||||
out = formats.JSONStructArray{Output: toGeneric(imageOutput)}
|
||||
default:
|
||||
out = formats.StdoutTemplate{Output: toGeneric(imageOutput), Template: outputFormat, Fields: imageOutput[0].headerMap()}
|
||||
out = formats.StdoutTemplateArray{Output: toGeneric(imageOutput), Template: outputFormat, Fields: imageOutput[0].headerMap()}
|
||||
}
|
||||
|
||||
formats.Writer(out).Out()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue