1
0
mirror of https://github.com/docker/cli.git synced 2026-01-26 15:41:42 +03:00

image/tree: Fix width calculation for untagged images

When calculating column widths for the tree view, untagged images
weren't being properly accounted for in the width calculation.

This caused layout issues when there were tagged images were shorter
than the `<untagged>` string.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-12-12 11:18:27 +01:00
parent 150a25b9ff
commit b315983898

View File

@@ -547,7 +547,11 @@ func (h imgColumn) PrintR(clr aec.ANSI, s string) string {
func widestFirstColumnValue(headers []imgColumn, images []topImage) int {
width := len(headers[0].Title)
for _, img := range images {
for _, name := range img.Names {
names := img.Names
if len(names) == 0 {
names = []string{untaggedName}
}
for _, name := range names {
if len(name) > width {
width = len(name)
}