MCPcopy Create free account
hub / github.com/diillson/chatcli / preview

Function preview

cli/coder/input_guard.go:157–171  ·  view source on GitHub ↗

preview returns a short, escape-stripped excerpt of an input line for safe logging. We never want to dump full user input to the log.

(s string)

Source from the content-addressed store, hash-verified

155// preview returns a short, escape-stripped excerpt of an input line for
156// safe logging. We never want to dump full user input to the log.
157func preview(s string) string {
158 const maxLen = 24
159 out := make([]rune, 0, maxLen)
160 for _, r := range s {
161 if r < 0x20 || r == 0x7f {
162 continue
163 }
164 out = append(out, r)
165 if len(out) >= maxLen {
166 out = append(out, '…')
167 break
168 }
169 }
170 return string(out)
171}

Callers 1

DrainStdinChannelMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected