summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-06-23 11:19:33 -0500
committerMatthew Heon <mheon@redhat.com>2020-06-24 14:41:24 -0400
commit9a4517b3706847d45c575839200f2d8f536c7738 (patch)
tree368b8cb074ca8a55c777a6a3374e762aabe803f3 /cmd/podman
parent61bd645732225ebe563ad8628a2279b5e226a278 (diff)
downloadpodman-9a4517b3706847d45c575839200f2d8f536c7738.tar.gz
podman-9a4517b3706847d45c575839200f2d8f536c7738.tar.bz2
podman-9a4517b3706847d45c575839200f2d8f536c7738.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/podman')
-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
}