Documentation
¶
Index ¶
- Constants
- Variables
- func ClearLineFromCursor()
- func ClearTerminal()
- func ClearTerminalFromCursor()
- func CreateFgColor(red int, green int, blue int) string
- func Crop(text string, length int) (string, int)
- func GetCursorPosition(value string) (int, int, error)
- func GetWindowSize() (int, int)
- func HideCursor()
- func Measure(text string) int
- func PadRight(text string, maxLength int, gutter int) string
- func RequestCursorPos()
- func ResetStyle()
- func SetBgColor(red int, green int, blue int)
- func SetCursorPos(row int, col int)
- func SetFgColor(red int, green int, blue int)
- func ShowCursor()
- func StripTerminalEscapeSequences(data []byte) []byte
Constants ¶
const ( TERM_CLEAR = "\x1B[2J" TERM_CLEAR_END_OF_SCREEN = "\x1B[0J" TERM_CLEAR_END_OF_LINE = "\x1B[0K" STYLE_RESET = "\x1b[0m" STYLE_BOLD = "\x1b[1m" )
Variables ¶
var (
ErrNoMatch = errors.New("no match")
)
Functions ¶
func ClearLineFromCursor ¶
func ClearLineFromCursor()
func ClearTerminal ¶
func ClearTerminal()
ClearTerminal clears the terminal without repositioning the cursor
func ClearTerminalFromCursor ¶
func ClearTerminalFromCursor()
func Crop ¶
Crop ensures that the supplied text is cropped to the target length. If it exceeds the target length, the last (max) 3 characters are replaced with ellipsis. Returned are the cropped string, and the final visible length after cropping.
func GetCursorPosition ¶
GetCursorPosition returns row, column or an error
func GetWindowSize ¶
GetWindowSize returns the size of the window (row, col)
func HideCursor ¶
func HideCursor()
func Measure ¶
Measure returns the number of horizonal space the provided text accounts for. This will filter out escape characters, and treat multi-byte unicode characters as single space tenants.
func PadRight ¶
PadRight pads text to the right, cropping anything over the supplied maxLength, preserving up to n gutter chars on the right.
func RequestCursorPos ¶
func RequestCursorPos()
func ResetStyle ¶
func ResetStyle()
func SetBgColor ¶
func SetCursorPos ¶
SetCursorPos sets the current cursor position. row and col start from 1
func SetFgColor ¶
func ShowCursor ¶
func ShowCursor()
func StripTerminalEscapeSequences ¶
StripTerminalEscapeSequences removes all terminal escape sequences from the provided string, and returns the remaining string
Types ¶
This section is empty.