image/list: Print legend only if limiting width

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-11-13 12:11:24 +01:00
parent aa5d00a3a4
commit ed281ddf52
5 changed files with 5 additions and 5 deletions

View File

@ -1,2 +1 @@
Info -> U In Use
IMAGE ID DISK USAGE CONTENT SIZE EXTRA

View File

@ -1,2 +1 @@
Info -> U In Use
IMAGE ID DISK USAGE CONTENT SIZE EXTRA

View File

@ -1,2 +1 @@
Info -> U In Use
IMAGE ID DISK USAGE CONTENT SIZE EXTRA

View File

@ -1,2 +1 @@
Info -> U In Use
IMAGE ID DISK USAGE CONTENT SIZE EXTRA

View File

@ -233,6 +233,7 @@ func printImageTree(outs command.Streams, view treeView) {
isTerm := out.IsTerminal()
_, width := out.GetTtySize()
limitWidth := width == 0
if isTerm && width < 20 {
width = 20
}
@ -242,7 +243,10 @@ func printImageTree(outs command.Streams, view treeView) {
untaggedColor := out.Color(tui.ColorTertiary)
titleColor := out.Color(tui.ColorTitle)
out.Println(generateLegend(out, width))
// Legend is right-aligned, so don't print it if the width is unlimited
if !limitWidth {
out.Println(generateLegend(out, width))
}
possibleChips := getPossibleChips(view)
columns := []imgColumn{