-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformat_error.awk
75 lines (67 loc) · 1.1 KB
/
format_error.awk
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
BEGIN {
indentationLevel=0
RS=" "
ORS=" "
OFS=" "
isTemplate="false"
isExecuting="false"
isAt=false
}
/template:/ {
isTemplate="true"
isExecuting="false"
isAt=false
printf "\n"
indentationLevel=2
for (i = 0; i <= indentationLevel; i += 1) printf " "
printf "%s", $0
next
}
/executing/ {
isExecuting="true"
isTemplate="false"
isAt="false"
printf "\n"
indentationLevel=4
for (i = 0; i <= indentationLevel; i += 1) printf " "
printf "%s", $0
next
}
$0 == "at" {
isTemplate="false"
isExecuting="false"
isAt="true"
printf "\n"
indentationLevel=6
for (i = 0; i < indentationLevel; i += 1) printf " "
printf "%s", $0
next
}
/>:$/ {
if ( isAt == "true"){
printf "\033[32m"
}
isAt="false"
printf " %s", substr($0, 1, length($0) - 1)
printf "\033[0m"
printf ":"
printf "\n"
next
}
{
if (isTemplate == "true"){
printf "\033[36m"
}
if (isExecuting == "true") {
printf "\033[35m"
}
if ( isAt == "true"){
printf "\033[32m"
}
printf " %s", $0
if (isAt == "true" || isExecuting == "true" || isTemplate == "true") {
printf "\033[0m"
}
isTemplate="false"
isExecuting="false"
}