vendor: github.com/docker/cli v29.0.1

full diff: https://github.com/docker/cli/compare/v29.0.0...v29.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-11-16 23:20:52 +01:00
parent b0b2a4e1ef
commit 2f462a4945
5 changed files with 19 additions and 14 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ func withHeader(header Str) noteOptions {
}
func (o Output) printNoteWithOptions(format string, args []any, opts ...noteOptions) {
if o.isTerminal {
if !o.noColor {
// TODO: Handle all flags
format = strings.ReplaceAll(format, "--platform", ColorFlag.Apply("--platform"))
}
@@ -51,7 +51,7 @@ func (o Output) printNoteWithOptions(format string, args []any, opts ...noteOpti
}
l := line
if o.isTerminal {
if !o.noColor {
l = aec.Italic.Apply(l)
}
_, _ = fmt.Fprintln(o, l)
+13 -8
View File
@@ -5,6 +5,7 @@ package tui
import (
"fmt"
"os"
"github.com/docker/cli/cli/streams"
"github.com/morikuni/aec"
@@ -12,7 +13,7 @@ import (
type Output struct {
*streams.Out
isTerminal bool
noColor bool
}
type terminalPrintable interface {
@@ -20,24 +21,28 @@ type terminalPrintable interface {
}
func NewOutput(out *streams.Out) Output {
noColor := !out.IsTerminal()
if os.Getenv("NO_COLOR") != "" {
noColor = true
}
return Output{
Out: out,
isTerminal: out.IsTerminal(),
Out: out,
noColor: noColor,
}
}
func (o Output) Color(clr aec.ANSI) aec.ANSI {
if o.isTerminal {
return clr
if o.noColor {
return ColorNone
}
return ColorNone
return clr
}
func (o Output) Sprint(all ...any) string {
var out []any
for _, p := range all {
if s, ok := p.(terminalPrintable); ok {
out = append(out, s.String(o.isTerminal))
out = append(out, s.String(!o.noColor))
} else {
out = append(out, p)
}
@@ -47,7 +52,7 @@ func (o Output) Sprint(all ...any) string {
func (o Output) PrintlnWithColor(clr aec.ANSI, args ...any) {
msg := o.Sprint(args...)
if o.isTerminal {
if !o.noColor {
msg = clr.Apply(msg)
}
_, _ = fmt.Fprintln(o.Out, msg)