mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
add image history when listing images
This commit is contained in:
parent
15bd991560
commit
2f1c246fd7
3 changed files with 15 additions and 3 deletions
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
|
|
@ -77,7 +76,12 @@ func (c *DockerCommand) GetImages() ([]*Image, error) {
|
||||||
ownImages := make([]*Image, len(images))
|
ownImages := make([]*Image, len(images))
|
||||||
|
|
||||||
for i, image := range images {
|
for i, image := range images {
|
||||||
c.Log.Warn(spew.Sdump(image))
|
// func (cli *Client) ImageHistory(ctx context.Context, imageID string) ([]image.HistoryResponseItem, error)
|
||||||
|
|
||||||
|
history, err := c.Client.ImageHistory(context.Background(), image.ID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
name := "none"
|
name := "none"
|
||||||
tags := image.RepoTags
|
tags := image.RepoTags
|
||||||
|
|
@ -95,6 +99,7 @@ func (c *DockerCommand) GetImages() ([]*Image, error) {
|
||||||
Client: c.Client,
|
Client: c.Client,
|
||||||
OSCommand: c.OSCommand,
|
OSCommand: c.OSCommand,
|
||||||
Log: c.Log,
|
Log: c.Log,
|
||||||
|
History: history,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ type Image struct {
|
||||||
Tag string
|
Tag string
|
||||||
ID string
|
ID string
|
||||||
Image types.ImageSummary
|
Image types.ImageSummary
|
||||||
|
History []types.ImageHistory
|
||||||
Client *client.Client
|
Client *client.Client
|
||||||
OSCommand *OSCommand
|
OSCommand *OSCommand
|
||||||
Log *logrus.Entry
|
Log *logrus.Entry
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,13 @@ func (gui *Gui) renderImageConfig(mainView *gocui.View, Image *commands.Image, w
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
gui.renderString(gui.g, "main", string(data))
|
|
||||||
|
historyData, err := json.MarshalIndent(&Image.History, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
gui.renderString(gui.g, "main", string(data)+"\n"+string(historyData))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue