MCPcopy Index your code
hub / github.com/cli/cli / WriteDelims

Function WriteDelims

pkg/jsoncolor/jsoncolor.go:109–119  ·  view source on GitHub ↗

WriteDelims writes delims in color and with the appropriate indent based on the stack size returned from an io.Writer that implements JsonWriter.Preface().

(w io.Writer, delims, indent string)

Source from the content-addressed store, hash-verified

107// WriteDelims writes delims in color and with the appropriate indent
108// based on the stack size returned from an io.Writer that implements JsonWriter.Preface().
109func WriteDelims(w io.Writer, delims, indent string) error {
110 var stack []json.Delim
111 if jaw, ok := w.(JsonWriter); ok {
112 stack = jaw.Preface()
113 }
114
115 fmt.Fprintf(w, "\x1b[%sm%s\x1b[m", colorDelim, delims)
116 fmt.Fprint(w, "\n", strings.Repeat(indent, len(stack)))
117
118 return nil
119}
120
121// marshalJSON works like json.Marshal but with HTML-escaping disabled
122func marshalJSON(v interface{}) ([]byte, error) {

Callers 2

CloseMethod · 0.92
startPageFunction · 0.92

Calls 1

PrefaceMethod · 0.65

Tested by

no test coverage detected