From 28ffe74e4441d96cb36abb58344824bfc4701c47 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Thu, 14 May 2020 14:12:24 -0400 Subject: fix bug --format {{json.}} of events Allow the `podman events --format` accept {{json.}} and complete small fix podman-events.1.md Signed-off-by: Qi Wang --- cmd/podman/system/events.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/system/events.go b/cmd/podman/system/events.go index 6aae62dc0..27e80138e 100644 --- a/cmd/podman/system/events.go +++ b/cmd/podman/system/events.go @@ -5,6 +5,7 @@ import ( "context" "html/template" "os" + "strings" "github.com/containers/buildah/pkg/formats" "github.com/containers/libpod/cmd/podman/registry" @@ -54,6 +55,9 @@ func eventsCmd(cmd *cobra.Command, args []string) error { eventsError error tmpl *template.Template ) + if strings.Join(strings.Fields(eventFormat), "") == "{{json.}}" { + eventFormat = formats.JSONString + } if eventFormat != formats.JSONString { tmpl, err = template.New("events").Parse(eventFormat) if err != nil { -- cgit v1.2.3-54-g00ecf