-
Notifications
You must be signed in to change notification settings - Fork 0
/
gput.go
188 lines (139 loc) · 2.87 KB
/
gput.go
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
package gput
import (
"strconv"
"log"
"strings"
"github.com/codeskyblue/go-sh"
)
func Setab(color int) {
sh.Command("tput", "setab", strconv.Itoa(color)).Run()
}
func Setb(color int) {
sh.Command("tput", "setb", strconv.Itoa(color)).Run()
}
func Setaf(color int) {
sh.Command("tput", "setaf", strconv.Itoa(color)).Run()
}
func Setf(color int) {
sh.Command("tput", "setf", strconv.Itoa(color)).Run()
}
func Bold() {
sh.Command("tput", "bold").Run()
}
func Dim() {
sh.Command("tput", "dim").Run()
}
func Smul() {
sh.Command("tput", "smul").Run()
}
func Rmul() {
sh.Command("tput", "rmul").Run()
}
func Rev() {
sh.Command("tput", "rev").Run()
}
func Blink() {
sh.Command("tput", "blink").Run()
}
func Invis() {
sh.Command("tput", "invis").Run()
}
func Smso() {
sh.Command("tput", "smso").Run()
}
func Rmso() {
sh.Command("tput", "rmso").Run()
}
func Sgr0() {
sh.Command("tput", "sgr0").Run()
}
func Cup(x int, y int) {
sh.Command("tput", "cup", strconv.Itoa(y), strconv.Itoa(x)).Run()
}
func Cub(chars int) {
sh.Command("tput", "cub", strconv.Itoa(chars)).Run()
}
func Cuf(chars int) {
sh.Command("tput", "cuf", strconv.Itoa(chars)).Run()
}
func Cuu(lines int) {
sh.Command("tput", "cuu", strconv.Itoa(lines)).Run()
}
func Cud(lines int) {
sh.Command("tput", "cud", strconv.Itoa(lines)).Run()
}
func Cub1() {
sh.Command("tput", "cub1").Run()
}
func Cuf1() {
sh.Command("tput", "cuf1").Run()
}
func Cuu1() {
sh.Command("tput", "cuu1").Run()
}
func Cud1() {
sh.Command("tput", "cud1").Run()
}
func Ll() {
sh.Command("tput", "ll").Run()
}
func Sc() {
sh.Command("tput", "sc").Run()
}
func Rc() {
sh.Command("tput", "rc").Run()
}
func Civis() {
sh.Command("tput", "civis").Run()
}
func Cnorm() {
sh.Command("tput", "cnorm").Run()
}
func Lines()(int) {
output, err := sh.Command("tput", "lines").Output()
lines, err := strconv.Atoi(strings.TrimSpace(string(output)))
if err != nil {
log.Fatal(err)
}
return lines;
}
func Cols()(int) {
output, err := sh.Command("tput", "cols").Output()
cols, err := strconv.Atoi(strings.TrimSpace(string(output)))
if err != nil {
log.Fatal(err)
}
return cols;
}
func Colors()(int) {
output, err := sh.Command("tput", "colors").Output()
colors, err := strconv.Atoi(strings.TrimSpace(string(output)))
if err != nil {
log.Fatal(err)
}
return colors;
}
func Clear() {
sh.Command("tput", "clear").Run()
}
func Ech(chars int) {
sh.Command("tput", "ech", strconv.Itoa(chars)).Run()
}
func El1() {
sh.Command("tput", "el1").Run()
}
func El() {
sh.Command("tput", "el").Run()
}
func Ed() {
sh.Command("tput", "ed").Run()
}
func Ich(chars int) {
sh.Command("tput", "ich", strconv.Itoa(chars)).Run()
}
func Il(lines int) {
sh.Command("tput", "il", strconv.Itoa(lines)).Run()
}
func Dl(lines int) {
sh.Command("tput", "dl", strconv.Itoa(lines)).Run()
}