image/tree: Fix table header having escape codes when not tty
When stdout is redirected to a non-tty there should be no ANSI escape codes emitted. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
Info -> U In Use
|
||||
[39m[1mIMAGE[0m [39m[1mID[0m [39m[1mDISK USAGE[0m [39m[1mCONTENT SIZE[0m [39m[1mEXTRA[0m
|
||||
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
Info -> U In Use
|
||||
[39m[1mIMAGE[0m [39m[1mID[0m [39m[1mDISK USAGE[0m [39m[1mCONTENT SIZE[0m [39m[1mEXTRA[0m
|
||||
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
Info -> U In Use
|
||||
[39m[1mIMAGE[0m [39m[1mID[0m [39m[1mDISK USAGE[0m [39m[1mCONTENT SIZE[0m [39m[1mEXTRA[0m
|
||||
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
Info -> U In Use
|
||||
[39m[1mIMAGE[0m [39m[1mID[0m [39m[1mDISK USAGE[0m [39m[1mCONTENT SIZE[0m [39m[1mEXTRA[0m
|
||||
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
|
||||
|
||||
@ -241,6 +241,8 @@ func printImageTree(outs command.Streams, view treeView) {
|
||||
topNameColor := out.Color(aec.NewBuilder(aec.BlueF, aec.Bold).ANSI)
|
||||
normalColor := out.Color(tui.ColorSecondary)
|
||||
untaggedColor := out.Color(tui.ColorTertiary)
|
||||
titleColor := out.Color(tui.ColorTitle)
|
||||
|
||||
isTerm := out.IsTerminal()
|
||||
|
||||
out.Println(generateLegend(out, width))
|
||||
@ -316,7 +318,7 @@ func printImageTree(outs command.Streams, view treeView) {
|
||||
_, _ = fmt.Fprint(out, strings.Repeat(" ", columnSpacing))
|
||||
}
|
||||
|
||||
_, _ = fmt.Fprint(out, h.Print(tui.ColorTitle, strings.ToUpper(h.Title)))
|
||||
_, _ = fmt.Fprint(out, h.Print(titleColor, strings.ToUpper(h.Title)))
|
||||
}
|
||||
_, _ = fmt.Fprintln(out)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user