tool

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// FgBlack terminal color code
	FgBlack = 30
	// FgRed terminal color code
	FgRed = 31
	// FgGreen terminal color code
	FgGreen = 32
	// FgYellow terminal color code
	FgYellow = 33
	// FgBlue terminal color code
	FgBlue = 34
	// FgMagenta terminal color code
	FgMagenta = 35
	// FgCyan terminal color code
	FgCyan = 36
	// FgLightGray terminal color code
	FgLightGray = 37
	// FgDarkGray terminal color code
	FgDarkGray = 90
	// FgLightRed terminal color code
	FgLightRed = 91
	// FgLightGreen terminal color code
	FgLightGreen = 92
	// FgLightYellow terminal color code
	FgLightYellow = 93
	// FgLightBlue terminal color code
	FgLightBlue = 94
	// FgLightMagenta terminal color code
	FgLightMagenta = 95
	// FgLightCyan terminal color code
	FgLightCyan = 96
	// FgWhite terminal color code
	FgWhite = 97

	// BgNormal terminal color code
	BgNormal = 0
	// BgBoldOrBright terminal color code
	BgBoldOrBright = 1
	// BgDim terminal color code
	BgDim = 2
	// BgItalic terminal color code
	BgItalic = 3
	// BgUnderline terminal color code
	BgUnderline = 4
	// BgUlink terminal color code
	BgUlink = 5
	// BgInverse _
	BgInverse = 7
	// BgHidden terminal color code
	BgHidden = 8
	// BgStrikeout terminal color code
	BgStrikeout = 9

	// DarkColor terminal color code
	DarkColor = FgLightGray
)

Variables

This section is empty.

Functions

func EraseAnyWSs

func EraseAnyWSs(s string) string

EraseAnyWSs eats any whitespaces inside the giving string s.

func GetNoColorMode

func GetNoColorMode() bool

func IsTtyEscaped

func IsTtyEscaped(s string) bool

IsTtyEscaped detects a string if it contains ansi color escaped sequences

func StripEscapes

func StripEscapes(str string) (strCleaned string)

StripEscapes removes any ansi color escaped sequences from a string

func StripHTMLTags

func StripHTMLTags(s string) string

StripHTMLTags aggressively strips HTML tags from a string. It will only keep anything between `>` and `<`.

func StripLeftTabs

func StripLeftTabs(s string) string

StripLeftTabs strips the least left side tab chars from lines. StripLeftTabs strips html tags too.

func StripLeftTabsOnly

func StripLeftTabsOnly(s string) string

StripLeftTabsOnly strips the least left side tab chars from lines.

func StripQuotes

func StripQuotes(s string) string

StripQuotes strips single or double quotes around a string.

Types

type ColorTranslator

type ColorTranslator interface {
	Translate(s string, initialFg int) string
	Colorize(s string, clr int) string
}

ColorTranslator _

func GetStockedCPT added in v1.1.0

func GetStockedCPT() ColorTranslator

func NewCPT added in v1.1.0

func NewCPT() ColorTranslator

func NewCPTNoColor added in v1.1.0

func NewCPTNoColor() ColorTranslator

Jump to

Keyboard shortcuts

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