termtext

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 2 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 termtext cleans raw process output — captured from a PTY, so full of terminal control sequences — for display. The TUI keeps colour and strips only what would corrupt its layout (StripUnsafe); an agent reading logs wants plain text with no escape sequences at all (Plain).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Plain

func Plain(s string) string

Plain reduces a line to printable text: every escape sequence goes (StripUnsafe then StripANSI), and so does any C0 control byte left behind — a lone ESC from a sequence cut off mid-line, a bell, a backspace. What remains is safe to hand to an agent or a JSON consumer as-is.

func StripANSI

func StripANSI(s string) string

StripANSI removes CSI sequences of the simple "ESC [ digits ; letter" shape — in practice, SGR colour codes.

func StripUnsafe

func StripUnsafe(s string) string

StripUnsafe removes every control sequence except SGR colour codes, and expands tabs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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