Fancier output for 'docker history'
This commit is contained in:
parent
5e561a9d52
commit
09b27f9e8d
15
commands.go
15
commands.go
|
@ -330,14 +330,15 @@ func (srv *Server) CmdHistory(stdin io.ReadCloser, stdout io.Writer, args ...str
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var child *Image
|
w := tabwriter.NewWriter(stdout, 20, 1, 3, ' ', 0)
|
||||||
|
defer w.Flush()
|
||||||
|
fmt.Fprintf(w, "ID\tCREATED\tCREATED BY\n")
|
||||||
return image.WalkHistory(func(img *Image) error {
|
return image.WalkHistory(func(img *Image) error {
|
||||||
if child == nil {
|
fmt.Fprintf(w, "%s\t%s\t%s\n",
|
||||||
fmt.Fprintf(stdout, " %s\n", img.Id)
|
img.Id,
|
||||||
} else {
|
HumanDuration(time.Now().Sub(img.Created))+" ago",
|
||||||
fmt.Fprintf(stdout, " = %s + %s\n", img.Id, strings.Join(child.ParentCommand, " "))
|
strings.Join(img.ParentCommand, " "),
|
||||||
}
|
)
|
||||||
child = img
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue