MCPcopy
hub / github.com/pranshuparmar/witr / SanitizeTerminalLine

Function SanitizeTerminalLine

internal/output/sanitize.go:76–81  ·  view source on GitHub ↗

SanitizeTerminalLine is SanitizeTerminal for values rendered as a single line or table cell (process names, command lines, env entries, paths). SanitizeTerminal intentionally preserves \n and \t for multi-line layout; in a single-line field those let an embedded value forge extra output lines or shi

(s string)

Source from the content-addressed store, hash-verified

74// single-line field those let an embedded value forge extra output lines or
75// shift columns, so they are escaped here too.
76func SanitizeTerminalLine(s string) string {
77 if strings.ContainsAny(s, "\n\t") {
78 s = strings.NewReplacer("\n", `\n`, "\t", `\t`).Replace(s)
79 }
80 return SanitizeTerminal(s)
81}
82
83func appendEscapedByte(b *strings.Builder, bt byte) {
84 b.WriteString(`\x`)

Callers 11

filterProcessesMethod · 0.92
updateEnvViewportMethod · 0.92
renderTreeContentMethod · 0.92
updateContainerTableMethod · 0.92
updateLockTableMethod · 0.92
sanitizePrintArgsFunction · 0.85
RenderStandardFunction · 0.85
RenderContainerFallbackFunction · 0.85

Calls 1

SanitizeTerminalFunction · 0.85