-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_issues_summary.awk
More file actions
163 lines (149 loc) · 3.4 KB
/
create_issues_summary.awk
File metadata and controls
163 lines (149 loc) · 3.4 KB
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
BEGIN {
# Order by indices in descending order compared as strings
# https://www.gnu.org/software/gawk/manual/html_node/Controlling-Scanning.html
PROCINFO["sorted_in"] = "@ind_str_desc";
#
IGNORECASE = 1; # Ignore Case in Search Strings
RS = "\r?\n"; # Allow for MS-Windows Line Endings
}
/^FILENAME [|]/ {
$0 = substr($0, 12);
gsub(/^[ \t]+|[ \t]+$/, "", $0);
gsub(/[.]md/, "", $0);
fn = $0;
tt[fn] = "(null T)";
st[fn] = "(null S)";
as[fn] = "(null A)";
ms[fn] = "(null M)";
eh[fn] = "0E";
pc[fn] = "0P";
lb[fn] = "(null L)";
next;
}
/^Issue [|]/ {
$0 = substr($0, 12);
gsub(/^[ \t]+|[ \t]+$/, "", $0);
if (length($0) > 0) {
tt[fn] = $0;
}
next;
}
/^Status [|]/ {
$0 = substr($0, 12);
gsub(/^[ \t]+|[ \t]+$/, "", $0);
if (length($0) > 0) {
st[fn] = toupper($0);
}
stc[st[fn]] += 1;
next;
}
/^Assigned [|]/ {
$0 = substr($0, 12);
gsub(/^[ \t]+|[ \t]+$/, "", $0);
if (length($0) > 0) {
as[fn] = toupper($0);
}
asc[as[fn]] += 1;
next;
}
/^Milestone [|]/ {
$0 = substr($0, 12);
gsub(/^[ \t]+|[ \t]+$/, "", $0);
if (length($0) > 0) {
ms[fn] = toupper($0);
}
msc[ms[fn]] += 1;
next;
}
/^Est Hrs [|]/ {
$0 = substr($0, 12);
gsub(/^[ \t]+|[ \t]+$/, "", $0);
if (length($0) > 0) {
eh[fn] = $0;
}
next;
}
/^[%]Complete [|]/ {
$0 = substr($0, 12);
gsub(/^[ \t]+|[ \t]+$/, "", $0);
if (length($0) > 0) {
pc[fn] = $0;
}
next;
}
/^Labels [|]/ {
$0 = substr($0, 12);
gsub(/^[ \t]+|[ \t]+$/, "", $0);
if (length($0) > 0) {
lb[fn] = toupper($0);
}
lbc[lb[fn]] += 1;
next;
}
END {
print "## Statuses";
tot = 0;
for (sti in stc) {
print "* **[" sti "](Z-Issues-Summary#" sti "-issues)** - " stc[sti];
tot += stc[sti];
}
print "";
print "**Total Statuses:** " tot;
print "";
print "## Assignments";
tot = 0;
for (asi in asc) {
print "* **" asi "** - " asc[asi];
tot += asc[asi];
}
print "";
print "**Total Assignments:** " tot;
print "";
print "## Milestones";
tot = 0;
for (msi in msc) {
print "* **" msi "** - " msc[msi];
tot += msc[msi];
}
print "";
print "**Total Milestones:** " tot;
print "";
print "## Labels";
tot = 0;
for (lbi in lbc) {
print "* **" lbi "** - " lbc[lbi];
tot += lbc[lbi];
}
print "";
print "**Total Labels:** " tot;
print "";
lt = 0;
for (sti in stc) {
print "## " sti " Issues";
ln=0;
for (fn in tt) {
if (st[fn] == sti) {
ln += 1;
lt += 1;
if ( ln % 10 == 1 ) {
print "";
print "Page Name | Assigned | Milestone | Est | Pct | Label | Title";
print "------------------|----------------|-----------|-----|-----|-----------|-------";
}
printf "%-18s", "[" fn ".md](" fn ")";
printf "| %-15s", as[fn];
printf "| %-10s", ms[fn];
printf "| %-4s", eh[fn];
printf "| %-4s", pc[fn];
printf "| %-10s", lb[fn];
printf "| %s\n", tt[fn];
}
}
print ""
print "**Total " sti " Issues:** " ln;
print ""
}
print ""
print "**Grand Total Issues:** " lt;
print ""
}