From bdce43971f47835b35f06165bd82df7406117f5c Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Mon, 26 Sep 2016 11:28:03 -0700 Subject: [PATCH] Improve pod status output formatting Signed-off-by: Mrunal Patel --- cmd/client/sandbox.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmd/client/sandbox.go b/cmd/client/sandbox.go index e4adfcd0..b64be46c 100644 --- a/cmd/client/sandbox.go +++ b/cmd/client/sandbox.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "time" "github.com/urfave/cli" "golang.org/x/net/context" @@ -181,6 +182,19 @@ func PodSandboxStatus(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.Linux != nil { + fmt.Printf("Network namespace: %s\n", *r.Status.Linux.Namespaces.Network) + } + if r.Status.Network != nil { + fmt.Printf("IP Address: %v\n", *r.Status.Network.Ip) + } return nil }