tty

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: Apache-2.0 Imports: 1 Imported by: 1

README

go-tty godoc reference

Go repository with utilities constants and functions for working with terminal (tty).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnsiEscape

func AnsiEscape(c ...interface{}) (out string)

AnsiEscape accepts ANSI escape codes and strings to form escape sequences. For example, to create a string with a colorized prefix,

AnsiEscape(BOLD, GREEN, "[DEBUG] ", OFF, "Here is the debug output")

and a nicely escaped string for terminal output will be returned.

func AnsiEscapeS

func AnsiEscapeS(code ECode, msg string) string

AnsiEscapeS is like AnsiEscape, but takes only one escape code, and wrap the given text using that code and OFF

Types

type ECode

type ECode int

ECode is an ANSI escape code

const (
	OFF  ECode = iota
	BOLD       // 1

	UNDERLINE // 4
	BLINK     // 5

	REVERSE   // 7
	CONCEALED // 8
)

General text attributes

const (
	BLACK   ECode = iota + 30
	RED           // 31
	GREEN         // 32
	YELLOW        // 33
	BLUE          // 34
	MAGENTA       // 35
	CYAN          // 36
	WHITE         // 37
)

Foreground text attributes

const (
	BG_GREY    ECode = iota + 40
	BG_RED           // 41
	BG_GREEN         // 42
	BG_YELLOW        // 43
	BG_BLUE          // 44
	BG_MAGENTA       // 45
	BG_CYAN          // 46
	BG_WHITE         // 47
)

Background text attributes

Jump to

Keyboard shortcuts

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