From ed281ddf5264fa08bbe02265f89f9cfe18787ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Thu, 13 Nov 2025 12:11:24 +0100 Subject: [PATCH] image/list: Print legend only if limiting width MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Gronowski --- .../image/testdata/list-command-success.filters.golden | 1 - .../image/testdata/list-command-success.format.golden | 1 - .../image/testdata/list-command-success.match-name.golden | 1 - .../image/testdata/list-command-success.simple.golden | 1 - cli/command/image/tree.go | 6 +++++- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cli/command/image/testdata/list-command-success.filters.golden b/cli/command/image/testdata/list-command-success.filters.golden index 0d9b305994..cca2da1995 100644 --- a/cli/command/image/testdata/list-command-success.filters.golden +++ b/cli/command/image/testdata/list-command-success.filters.golden @@ -1,2 +1 @@ - Info -> U In Use IMAGE ID DISK USAGE CONTENT SIZE EXTRA diff --git a/cli/command/image/testdata/list-command-success.format.golden b/cli/command/image/testdata/list-command-success.format.golden index 0d9b305994..cca2da1995 100644 --- a/cli/command/image/testdata/list-command-success.format.golden +++ b/cli/command/image/testdata/list-command-success.format.golden @@ -1,2 +1 @@ - Info -> U In Use IMAGE ID DISK USAGE CONTENT SIZE EXTRA diff --git a/cli/command/image/testdata/list-command-success.match-name.golden b/cli/command/image/testdata/list-command-success.match-name.golden index 0d9b305994..cca2da1995 100644 --- a/cli/command/image/testdata/list-command-success.match-name.golden +++ b/cli/command/image/testdata/list-command-success.match-name.golden @@ -1,2 +1 @@ - Info -> U In Use IMAGE ID DISK USAGE CONTENT SIZE EXTRA diff --git a/cli/command/image/testdata/list-command-success.simple.golden b/cli/command/image/testdata/list-command-success.simple.golden index 0d9b305994..cca2da1995 100644 --- a/cli/command/image/testdata/list-command-success.simple.golden +++ b/cli/command/image/testdata/list-command-success.simple.golden @@ -1,2 +1 @@ - Info -> U In Use IMAGE ID DISK USAGE CONTENT SIZE EXTRA diff --git a/cli/command/image/tree.go b/cli/command/image/tree.go index 3087aa48a2..0c7ede0def 100644 --- a/cli/command/image/tree.go +++ b/cli/command/image/tree.go @@ -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{