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

Method printNoteWithOptions

internal/tui/note.go:30–59  ·  view source on GitHub ↗
(format string, args []any, opts ...noteOptions)

Source from the content-addressed store, hash-verified

28}
29
30func (o Output) printNoteWithOptions(format string, args []any, opts ...noteOptions) {
31 if !o.noColor {
32 // TODO: Handle all flags
33 format = strings.ReplaceAll(format, "--platform", ColorFlag.Apply("--platform"))
34 }
35
36 opt := &options{
37 header: InfoHeader,
38 }
39
40 for _, override := range opts {
41 override(opt)
42 }
43
44 h := o.Sprint(opt.header)
45
46 _, _ = fmt.Fprint(o, "\n", h)
47 s := fmt.Sprintf(format, args...)
48 for idx, line := range strings.Split(s, "\n") {
49 if idx > 0 {
50 _, _ = fmt.Fprint(o, strings.Repeat(" ", Width(h)))
51 }
52
53 l := line
54 if !o.noColor {
55 l = aec.Italic.Apply(l)
56 }
57 _, _ = fmt.Fprintln(o, l)
58 }
59}
60
61func (o Output) PrintNote(format string, args ...any) {
62 o.printNoteWithOptions(format, args, withHeader(InfoHeader))

Callers 2

PrintNoteMethod · 0.95
PrintWarningMethod · 0.95

Calls 3

SprintMethod · 0.95
WidthFunction · 0.85
ApplyMethod · 0.80

Tested by

no test coverage detected