MCPcopy Index your code
hub / github.com/docker/cli / widestFirstColumnValue

Function widestFirstColumnValue

cli/command/image/tree.go:545–565  ·  view source on GitHub ↗

widestFirstColumnValue calculates the width needed to fully display the image names and platforms.

(headers []imgColumn, images []topImage)

Source from the content-addressed store, hash-verified

543
544// widestFirstColumnValue calculates the width needed to fully display the image names and platforms.
545func widestFirstColumnValue(headers []imgColumn, images []topImage) int {
546 width := len(headers[0].Title)
547 for _, img := range images {
548 names := img.Names
549 if len(names) == 0 {
550 names = []string{untaggedName}
551 }
552 for _, name := range names {
553 if len(name) > width {
554 width = len(name)
555 }
556 }
557 for _, sub := range img.Children {
558 pl := len(sub.Platform) + len("└─ ")
559 if pl > width {
560 width = pl
561 }
562 }
563 }
564 return width
565}

Callers 1

adjustColumnsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…