From 9ec0e10484ef9732ba1c4bbb2a9e3620286a5ff3 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Tue, 23 Jun 2020 11:19:33 -0500 Subject: Add JSON output field for ps the toolbox team needs a field in our ps json that represents a human readable time. Signed-off-by: Brent Baude --- cmd/podman/containers/ps.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index ffd2054a6..5d3c9263e 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -110,7 +110,12 @@ func checkFlags(c *cobra.Command) error { } func jsonOut(responses []entities.ListContainer) error { - b, err := json.MarshalIndent(responses, "", " ") + r := make([]entities.ListContainer, 0) + for _, con := range responses { + con.CreatedAt = units.HumanDuration(time.Since(time.Unix(con.Created, 0))) + " ago" + r = append(r, con) + } + b, err := json.MarshalIndent(r, "", " ") if err != nil { return err } -- cgit v1.2.3-54-g00ecf