Skip to content

Commit b315983

Browse files
committed
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>
1 parent 150a25b commit b315983

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cli/command/image/tree.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,11 @@ func (h imgColumn) PrintR(clr aec.ANSI, s string) string {
547547
func widestFirstColumnValue(headers []imgColumn, images []topImage) int {
548548
width := len(headers[0].Title)
549549
for _, img := range images {
550-
for _, name := range img.Names {
550+
names := img.Names
551+
if len(names) == 0 {
552+
names = []string{untaggedName}
553+
}
554+
for _, name := range names {
551555
if len(name) > width {
552556
width = len(name)
553557
}

0 commit comments

Comments
 (0)