@@ -196,12 +196,17 @@ func defaultContext() (EvalContext, bool) {
196
196
return context , true
197
197
}
198
198
199
- func PrintFlagsSummary ( flags []Token ) {
199
+ func MaxLocWidthPlusOne ( tokens []Token ) int {
200
200
locWidth := 0
201
- for _ , flag := range flags {
201
+ for _ , token := range tokens {
202
202
// TODO: Loc.String() should include the extra ":", but that requires a huge refactoring in all the places where call it explicitly or implicitly
203
- locWidth = max (locWidth , len (flag .Loc .String ()) + 1 )
203
+ locWidth = max (locWidth , len (token .Loc .String ()) + 1 )
204
204
}
205
+ return locWidth
206
+ }
207
+
208
+ func PrintFlagsSummary (flags []Token ) {
209
+ locWidth := MaxLocWidthPlusOne (flags )
205
210
// TODO: merge together parameters defined on the same line
206
211
for _ , flag := range flags {
207
212
fmt .Printf ("%-*s %s\n " , locWidth , flag .Loc .String () + ":" , string (flag .Text ))
@@ -244,12 +249,13 @@ func (context EvalContext) PrintSummary() error {
244
249
TwitchVodFileRegexp := "([0-9]+)-[0-9a-f\\ -]+\\ .mp4"
245
250
re := regexp .MustCompile (TwitchVodFileRegexp )
246
251
fmt .Printf (">>> Twitch Chat Logs (Detected by regex `%s`)\n " , TwitchVodFileRegexp )
252
+ locWidth := MaxLocWidthPlusOne (context .inputPathLog )
247
253
for _ , inputPath := range context .inputPathLog {
248
254
match := re .FindStringSubmatch (string (inputPath .Text ))
249
255
if len (match ) > 0 {
250
- fmt .Printf ("%s: https://www.twitchchatdownloader.com/video/%s\n " , inputPath .Loc , match [1 ])
256
+ fmt .Printf ("%-*s https://www.twitchchatdownloader.com/video/%s\n " , locWidth , inputPath .Loc . String () + ":" , match [1 ])
251
257
} else {
252
- fmt .Printf ("%s: NO MATCH\n " , inputPath .Loc )
258
+ fmt .Printf ("%-*s NO MATCH\n " , locWidth , inputPath .Loc . String () + ":" )
253
259
}
254
260
}
255
261
fmt .Println ()
0 commit comments