Documentation
¶
Overview ¶
Package textsafe makes text that a scanned manifest or cluster controls safe to print to a terminal or a CI log.
Object names, namespaces, file names, annotation values and the reasons and titles built from them reach the table, Markdown and warning output as they are in the YAML. A name such as "x\e[2J\e[31mRED\r" would clear the reviewer's screen, colour what follows, or (with a bare CR) overwrite the line a finding was printed on; a right-to-left override reorders what is shown. Escape replaces those characters with visible escapes, so the text is shown as what it holds.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Escape ¶
Escape returns s with every Unsafe rune, and every byte that is not valid UTF-8, written as a visible escape: \n, \r and \t for those three, \xNN for the other C0 controls, DEL and stray bytes, \uNNNN for the rest. A backslash is left as it is, so a Windows path stays readable; the escapes are for a person reading, not for parsing back. A string with nothing to escape is returned as it is, without allocating.
func Unsafe ¶
Unsafe reports whether r must not reach a terminal as itself: the C0 controls (tab, newline and CR included, so a field stays on one line and one column), DEL, the C1 controls, the bidirectional controls (the embeddings and overrides U+202A to U+202E, the isolates U+2066 to U+2069, the marks U+200E, U+200F and U+061C) and the line and paragraph separators U+2028 and U+2029.
Types ¶
This section is empty.