~poldi1405/go-ansi

ref: 76d320c6afe7577b81dc9a9196484bbcad5057a9 go-ansi/display.go -rw-r--r-- 970 bytes
76d320c6 — Moritz Poldrack added function to remove all ANSI-Codes from a string 1 year, 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package ansi

import "fmt"

// ClearRight clears all characters right of the cursor from the display
func ClearRight() string {
	return escape + fmt.Sprintf(clearLine, 0)
}

// ClearLeft clears all characters left of the cursor from the display
func ClearLeft() string {
	return escape + fmt.Sprintf(clearLine, 1)
}

// ClearLine clears all characters on the line
func ClearLine() string {
	return escape + fmt.Sprintf(clearLine, 2)
}

// ClearScreen clears the entire screen and moves the cursor to (0;0)
func ClearScreen() string {
	return escape + fmt.Sprintf(clearScreen, 2)
}

// ClearBegin clears the entire screen to (0;0)
func ClearBegin() string {
	return escape + fmt.Sprintf(clearScreen, 1)
}

// ClearEnd clears to the end of the screen
func ClearEnd() string {
	return escape + fmt.Sprintf(clearScreen, 0)
}

// ClearScreenBuffer clears the entire screen and the screenbuffer
func ClearScreenBuffer() string {
	return escape + fmt.Sprintf(clearScreen, 3)
}