Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clean ¶
Clean escapes the UTF8 encoded string provided as input so it is safe to print on a unix terminal. It removes non printing characters and substitutes the vt100 escape character 0x1b with '^'.
func CleanBytes ¶
CleanBytes is a wrapper around Clean to work on byte slices instead of strings.
Types ¶
type Writer ¶
Writer can be used to write data to the underlying io.Writer, while transparently sanitizing it. If an error occurs writing to a Writer, all subsequent writes will return the error. Note that the sanitization might alter the size of the actual data being written.
func (*Writer) Write ¶
Write writes p to the underlying io.Writer, after sanitizing it. It returns n = len(p) on a successful write (regardless of how much data is written). This is because the escaping function might alter the actual dimension of the data, but the caller is interested in knowing how much of what they wanted to write was actually written. In case of errors it (conservatively) returns n=0 and the error, and no other writes are possible.