Merge pull request #41 from mrunalp/ctr_status_output

Better output formatting for container status
This commit is contained in:
Antonio Murdaca 2016-09-20 08:09:35 +02:00 committed by GitHub
commit d61a3ac58d

View file

@ -209,7 +209,26 @@ func ContainerStatus(client pb.RuntimeServiceClient, ID string) error {
if err != nil { if err != nil {
return err 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 return nil
} }