tty

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RunesAlpha        = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	RunesAlphaNumeric = RunesAlpha + "0123456789"
)
View Source
const (
	FgBlack         = "\x1b[30m"
	FgRed           = "\x1b[31m"
	FgGreen         = "\x1b[32m"
	FgYellow        = "\x1b[33m"
	FgBlue          = "\x1b[34m"
	FgMagenta       = "\x1b[35m"
	FgCyan          = "\x1b[36m"
	FgWhite         = "\x1b[37m"
	FgDefault       = "\x1b[39m"
	BgBlack         = "\x1b[40m"
	BgRed           = "\x1b[41m"
	BgGreen         = "\x1b[42m"
	BgYellow        = "\x1b[43m"
	BgBlue          = "\x1b[44m"
	BgMagenta       = "\x1b[45m"
	BgCyan          = "\x1b[46m"
	BgWhite         = "\x1b[47m"
	BgDefault       = "\x1b[49m"
	FgBrightBlack   = "\x1b[90m"
	FgBrightRed     = "\x1b[91m"
	FgBrightGreen   = "\x1b[92m"
	FgBrightYellow  = "\x1b[93m"
	FgBrightBlue    = "\x1b[94m"
	FgBrightMagenta = "\x1b[95m"
	FgBrightCyan    = "\x1b[96m"
	FgBrightWhite   = "\x1b[97m"
	BgBrightBlack   = "\x1b[100m"
	BgBrightRed     = "\x1b[101m"
	BgBrightGreen   = "\x1b[102m"
	BgBrightYellow  = "\x1b[103m"
	BgBrightBlue    = "\x1b[104m"
	BgBrightMagenta = "\x1b[105m"
	BgBrightCyan    = "\x1b[106m"
	BgBrightWhite   = "\x1b[107m"
	Bold            = "\x1b[1m"
	NoBold          = "\x1b[22m"
	Underline       = "\x1b[4m"
	NoUnderline     = "\x1b[24m"
	Reset           = "\x1b[0m"
)

Variables

This section is empty.

Functions

func Color256

func Color256(b byte) string

func FprintKV

func FprintKV(wr io.Writer, k string, v ...any) (int, error)

func IsATTY

func IsATTY(f *os.File) bool

func Mods

func Mods(str string, mods ...string) string

func NewANSIStripper

func NewANSIStripper(wr io.Writer) io.Writer

func NewIndenter

func NewIndenter(w io.Writer, indent string) io.Writer

NewIndenter returns an io.Writer that prefixes the lines written to it with indent and then writes them to w. The writer returns the number of bytes written to the underlying Writer.

func PrettyDuration

func PrettyDuration(left time.Duration) string

PrettyDuration pretty prints a time just like `wg show` See: https://github.com/WireGuard/wireguard-tools/blob/71799a8f6d1450b63071a21cad6ed434b348d3d5/src/show.c#L129

func QRCode

func QRCode(buf string)

func ReIndentJSON

func ReIndentJSON(j []byte, prefix, indent string) ([]byte, error)

func StripANSI

func StripANSI(s string) string

func TrueColor

func TrueColor(r, g, b byte) string

Types

type WriteSyncer

type WriteSyncer interface {
	io.Writer
	Sync() error
}

func NewANSIStripperSynced

func NewANSIStripperSynced(wr WriteSyncer) WriteSyncer

Jump to

Keyboard shortcuts

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