mirror of https://github.com/docker/cli.git
Compare commits
2 Commits
54e475c64f
...
43eaaf54af
Author | SHA1 | Date |
---|---|---|
Yves Brissaud | 43eaaf54af | |
Yves Brissaud | 69e1a636ac |
|
@ -51,6 +51,12 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
|
||||||
|
|
||||||
var totalContent int64
|
var totalContent int64
|
||||||
children := make([]subImage, 0, len(img.Manifests))
|
children := make([]subImage, 0, len(img.Manifests))
|
||||||
|
attestations := make(map[string]bool)
|
||||||
|
for _, im := range img.Manifests {
|
||||||
|
if im.Kind == imagetypes.ManifestKindAttestation {
|
||||||
|
attestations[im.AttestationData.For.String()] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
for _, im := range img.Manifests {
|
for _, im := range img.Manifests {
|
||||||
if im.Kind != imagetypes.ManifestKindImage {
|
if im.Kind != imagetypes.ManifestKindImage {
|
||||||
continue
|
continue
|
||||||
|
@ -65,6 +71,7 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
|
||||||
DiskUsage: units.HumanSizeWithPrecision(float64(im.Size.Total), 3),
|
DiskUsage: units.HumanSizeWithPrecision(float64(im.Size.Total), 3),
|
||||||
InUse: len(im.ImageData.Containers) > 0,
|
InUse: len(im.ImageData.Containers) > 0,
|
||||||
ContentSize: units.HumanSizeWithPrecision(float64(im.Size.Content), 3),
|
ContentSize: units.HumanSizeWithPrecision(float64(im.Size.Content), 3),
|
||||||
|
Attestation: attestations[im.ID],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +109,7 @@ type imageDetails struct {
|
||||||
DiskUsage string
|
DiskUsage string
|
||||||
InUse bool
|
InUse bool
|
||||||
ContentSize string
|
ContentSize string
|
||||||
|
Attestation bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type topImage struct {
|
type topImage struct {
|
||||||
|
@ -162,6 +170,18 @@ func printImageTree(dockerCLI command.Cli, view treeView) error {
|
||||||
return stringid.TruncateID(d.ID)
|
return stringid.TruncateID(d.ID)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Title: "Attest",
|
||||||
|
Align: alignLeft,
|
||||||
|
Width: 6,
|
||||||
|
Color: &greenColor,
|
||||||
|
DetailsValue: func(d *imageDetails) string {
|
||||||
|
if d.Attestation {
|
||||||
|
return "✔"
|
||||||
|
}
|
||||||
|
return " "
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Title: "Disk usage",
|
Title: "Disk usage",
|
||||||
Align: alignRight,
|
Align: alignRight,
|
||||||
|
|
Loading…
Reference in New Issue