summaryrefslogtreecommitdiff
path: root/cmd/podman/images/trust_show.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/images/trust_show.go')
-rw-r--r--cmd/podman/images/trust_show.go27
1 files changed, 9 insertions, 18 deletions
diff --git a/cmd/podman/images/trust_show.go b/cmd/podman/images/trust_show.go
index c0e56f504..04ea24ca5 100644
--- a/cmd/podman/images/trust_show.go
+++ b/cmd/podman/images/trust_show.go
@@ -48,11 +48,12 @@ func showTrust(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
- if showTrustOptions.Raw {
+
+ switch {
+ case showTrustOptions.Raw:
fmt.Println(string(trust.Raw))
return nil
- }
- if showTrustOptions.JSON {
+ case showTrustOptions.JSON:
b, err := json.MarshalIndent(trust.Policies, "", " ")
if err != nil {
return err
@@ -60,23 +61,13 @@ func showTrust(cmd *cobra.Command, args []string) error {
fmt.Println(string(b))
return nil
}
+ rpt := report.New(os.Stdout, cmd.Name())
+ defer rpt.Flush()
- format := "{{range . }}{{.RepoName}}\t{{.Type}}\t{{.GPGId}}\t{{.SignatureStore}}\n{{end -}}"
- tmpl, err := report.NewTemplate("list").Parse(format)
- if err != nil {
- return err
- }
-
- w, err := report.NewWriterDefault(os.Stdout)
+ rpt, err = rpt.Parse(report.OriginPodman,
+ "{{range . }}{{.RepoName}}\t{{.Type}}\t{{.GPGId}}\t{{.SignatureStore}}\n{{end -}}")
if err != nil {
return err
}
-
- if err := tmpl.Execute(w, trust.Policies); err != nil {
- return err
- }
- if err := w.Flush(); err != nil {
- return err
- }
- return nil
+ return rpt.Execute(trust.Policies)
}