@@ -26,6 +26,8 @@ import (
26
26
"time"
27
27
28
28
"github.com/olekukonko/tablewriter"
29
+ "github.com/olekukonko/tablewriter/renderer"
30
+ "github.com/olekukonko/tablewriter/tw"
29
31
"github.com/sirupsen/logrus"
30
32
31
33
"sigs.k8s.io/release-utils/util"
@@ -42,9 +44,30 @@ func parsePatchSchedule(patchSchedule PatchSchedule) string {
42
44
if len (patchSchedule .UpcomingReleases ) > 0 {
43
45
output = append (output , "### Upcoming Monthly Releases\n " )
44
46
tableString := & strings.Builder {}
45
- table := tablewriter .NewWriter (tableString )
46
- table .SetAutoWrapText (false )
47
- table .SetHeader ([]string {"Monthly Patch Release" , "Cherry Pick Deadline" , "Target Date" })
47
+ table := tablewriter .NewTable (tableString ,
48
+ tablewriter .WithConfig (tablewriter.Config {
49
+ Header : tw.CellConfig {
50
+ Alignment : tw.CellAlignment {Global : tw .AlignLeft },
51
+ },
52
+ }),
53
+ tablewriter .WithHeader ([]string {"Monthly Patch Release" , "Cherry Pick Deadline" , "Target Date" }),
54
+ tablewriter .WithRenderer (renderer .NewMarkdown ()),
55
+ tablewriter .WithRendition (tw.Rendition {
56
+ Symbols : tw .NewSymbols (tw .StyleMarkdown ),
57
+ Borders : tw.Border {
58
+ Left : tw .On ,
59
+ Top : tw .Off ,
60
+ Right : tw .On ,
61
+ Bottom : tw .Off ,
62
+ },
63
+ Settings : tw.Settings {
64
+ Separators : tw.Separators {
65
+ BetweenRows : tw .On ,
66
+ },
67
+ },
68
+ }),
69
+ tablewriter .WithRowAutoWrap (tw .WrapNone ),
70
+ )
48
71
49
72
for _ , upcoming := range patchSchedule .UpcomingReleases {
50
73
targetDate , err := time .Parse (refDate , upcoming .TargetDate )
@@ -61,8 +84,6 @@ func parsePatchSchedule(patchSchedule PatchSchedule) string {
61
84
})
62
85
}
63
86
64
- table .SetBorders (tablewriter.Border {Left : true , Top : false , Right : true , Bottom : false })
65
- table .SetCenterSeparator ("|" )
66
87
table .Render ()
67
88
68
89
output = append (output , tableString .String ())
@@ -79,9 +100,30 @@ func parsePatchSchedule(patchSchedule PatchSchedule) string {
79
100
)
80
101
81
102
tableString := & strings.Builder {}
82
- table := tablewriter .NewWriter (tableString )
83
- table .SetAutoWrapText (false )
84
- table .SetHeader ([]string {"Patch Release" , "Cherry Pick Deadline" , "Target Date" , "Note" })
103
+ table := tablewriter .NewTable (tableString ,
104
+ tablewriter .WithConfig (tablewriter.Config {
105
+ Header : tw.CellConfig {
106
+ Alignment : tw.CellAlignment {Global : tw .AlignLeft },
107
+ },
108
+ }),
109
+ tablewriter .WithHeader ([]string {"Patch Release" , "Cherry Pick Deadline" , "Target Date" , "Note" }),
110
+ tablewriter .WithRenderer (renderer .NewMarkdown ()),
111
+ tablewriter .WithRendition (tw.Rendition {
112
+ Symbols : tw .NewSymbols (tw .StyleMarkdown ),
113
+ Borders : tw.Border {
114
+ Left : tw .On ,
115
+ Top : tw .Off ,
116
+ Right : tw .On ,
117
+ Bottom : tw .Off ,
118
+ },
119
+ Settings : tw.Settings {
120
+ Separators : tw.Separators {
121
+ BetweenRows : tw .On ,
122
+ },
123
+ },
124
+ }),
125
+ tablewriter .WithRowAutoWrap (tw .WrapNone ),
126
+ )
85
127
86
128
// Check if the next patch release is in the Previous Patch list, if yes dont read in the output
87
129
if ! patchReleaseInPreviousList (releaseSchedule .Next .Release , releaseSchedule .PreviousPatches ) {
@@ -92,8 +134,6 @@ func parsePatchSchedule(patchSchedule PatchSchedule) string {
92
134
table .Append ([]string {strings .TrimSpace (previous .Release ), strings .TrimSpace (previous .CherryPickDeadline ), strings .TrimSpace (previous .TargetDate ), strings .TrimSpace (previous .Note )})
93
135
}
94
136
95
- table .SetBorders (tablewriter.Border {Left : true , Top : false , Right : true , Bottom : false })
96
- table .SetCenterSeparator ("|" )
97
137
table .Render ()
98
138
99
139
output = append (output , tableString .String ())
@@ -131,16 +171,35 @@ func parseReleaseSchedule(releaseSchedule ReleaseSchedule) string {
131
171
132
172
for _ , releaseSchedule := range releaseSchedule .Releases {
133
173
tableString := & strings.Builder {}
134
- table := tablewriter .NewWriter (tableString )
135
- table .SetAutoWrapText (false )
136
- table .SetHeader ([]string {"**What**" , "**Who**" , "**When**" , "**WEEK**" , "**CI Signal**" })
174
+ table := tablewriter .NewTable (tableString ,
175
+ tablewriter .WithConfig (tablewriter.Config {
176
+ Header : tw.CellConfig {
177
+ Alignment : tw.CellAlignment {Global : tw .AlignLeft },
178
+ },
179
+ }),
180
+ tablewriter .WithHeader ([]string {"**What**" , "**Who**" , "**When**" , "**WEEK**" , "**CI Signal**" }),
181
+ tablewriter .WithRenderer (renderer .NewMarkdown ()),
182
+ tablewriter .WithRendition (tw.Rendition {
183
+ Symbols : tw .NewSymbols (tw .StyleMarkdown ),
184
+ Borders : tw.Border {
185
+ Left : tw .On ,
186
+ Top : tw .Off ,
187
+ Right : tw .On ,
188
+ Bottom : tw .Off ,
189
+ },
190
+ Settings : tw.Settings {
191
+ Separators : tw.Separators {
192
+ BetweenRows : tw .On ,
193
+ },
194
+ },
195
+ }),
196
+ tablewriter .WithRowAutoWrap (tw .WrapNone ),
197
+ )
137
198
138
199
for _ , timeline := range releaseSchedule .Timeline {
139
200
table .Append ([]string {strings .TrimSpace (timeline .What ), strings .TrimSpace (timeline .Who ), strings .TrimSpace (timeline .When ), strings .TrimSpace (timeline .Week ), strings .TrimSpace (timeline .CISignal ), "" })
140
201
}
141
202
142
- table .SetBorders (tablewriter.Border {Left : true , Top : false , Right : true , Bottom : false })
143
- table .SetCenterSeparator ("|" )
144
203
table .Render ()
145
204
146
205
relSched .TimelineOutput = tableString .String ()
0 commit comments