From 1263e543962c41566c549673fa95e39c623489ff Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Mon, 19 Sep 2016 15:16:28 -0700 Subject: [PATCH] Better output formatting for container status Signed-off-by: Mrunal Patel --- cmd/client/main.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cmd/client/main.go b/cmd/client/main.go index 07e26bbf..e95f4ea1 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -209,7 +209,26 @@ func ContainerStatus(client pb.RuntimeServiceClient, ID string) error { if err != nil { return err } - fmt.Println(r) + fmt.Printf("ID: %s\n", *r.Status.Id) + if r.Status.State != nil { + fmt.Printf("Status: %s\n", r.Status.State) + } + if r.Status.CreatedAt != nil { + ctm := time.Unix(*r.Status.CreatedAt, 0) + fmt.Printf("Created: %v\n", ctm) + } + if r.Status.StartedAt != nil { + stm := time.Unix(*r.Status.StartedAt, 0) + fmt.Printf("Started: %v\n", stm) + } + if r.Status.FinishedAt != nil { + ftm := time.Unix(*r.Status.FinishedAt, 0) + fmt.Printf("Finished: %v\n", ftm) + } + if r.Status.ExitCode != nil { + fmt.Printf("Exit Code: %v\n", *r.Status.ExitCode) + } + return nil }