-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathairline.go
110 lines (92 loc) · 1.69 KB
/
airline.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
// ==status=line==
// error line
var (
AirLineText string
airline string
BadError string
SimpleError string
slap string
cleanslap string
bk string
txt string
ErrorText []string
Alw *Window
)
const (
// errs
E_unused = iota
E_Invalid_Link = iota
E_Empty_Command = iota
E_No_Such_Command = iota
E_Cant_Write_To_File = iota
E_Cant_Create_File= iota
// err len
E_ = iota
)
func InitAirLine () {
// define colors
BadError = colors["ReportLine.BadError"]
SimpleError = colors["ReportLine.SimpleError"]
txt = colors["TextBkGrey"]
AirLineText = colors["AirLine.Text"]
bk = colors["AirLine.Bk"]
slap = AirLineText+sws+txt
cleanslap = txt+sws
// define errors
ErrorText = []string{
"UNUSED ERROR",
SimpleError+"Invalid Link",
SimpleError+"Empty Command",
BadError+"No Such Command \"%s\"",
BadError+"Can't Write To File %s: %s",
BadError+"Can't Create File %s",
}
// make airline window
Alw = MakeWin(
"AirLine Window",
stdout, stdin,
Win.LenY-2, Win.LenY, 0, Win.LenX,
)
}
func ClearAllAirLine() {
AirLine(slap)
ReportLine(cleanslap)
}
// AirLine
func AirLine ( s string ) {
// make bkground color
wuprint(Alw, 0, 0, slap)
// write
wuprint(Alw, 0, 0, s)
}
func ClearAirLine() {
AirLine(slap)
}
// warn
func Warn(warntype int) {
ClearReport()
ReportLine(ErrorText[warntype]+txt)
}
func AdvWarn(warntype int, inp ...string) {
ClearReport()
t:=ErrorText[warntype]
for i:=0;i<len(inp);i++ {
t = spf(t, inp[i])
}
ReportLine(t)
wColor(txt)
}
func ReportInternalError( s string, ec int ) {
ClearReport()
ReportLine(s)
wgtk(Alw)
if ec != 0 {
exit(ec)
}
}
func ClearReport() {
ReportLine(cleanslap)
}
func ReportLine ( s string ) {
wuprint(Alw, 1, 0, s)
}