aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-06-23 11:19:33 -0500
committerBrent Baude <bbaude@redhat.com>2020-06-23 11:24:27 -0500
commit9ec0e10484ef9732ba1c4bbb2a9e3620286a5ff3 (patch)
treee8fa64e7fb7e5630833b9676767b35990dffa861 /cmd
parent73514b1465fe2f79b82d017cdb11d587d6f7df3d (diff)
downloadpodman-9ec0e10484ef9732ba1c4bbb2a9e3620286a5ff3.tar.gz
podman-9ec0e10484ef9732ba1c4bbb2a9e3620286a5ff3.tar.bz2
podman-9ec0e10484ef9732ba1c4bbb2a9e3620286a5ff3.zip
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 <bbaude@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/containers/ps.go7
1 files changed, 6 insertions, 1 deletions
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
}