textsafe

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Escape(s string) string

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

func Unsafe(r rune) bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL