@@ -196,7 +196,16 @@ func defaultContext() (EvalContext, bool) {
196196 return context , true
197197}
198198
199- func MaxLocWidthPlusOne (tokens []Token ) int {
199+ func MaxChunksLocWidthPlusOne (chunks []Chunk ) int {
200+ locWidth := 0
201+ for _ , chunk := range chunks {
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 (chunk .Loc .String ()) + 1 )
204+ }
205+ return locWidth
206+ }
207+
208+ func MaxTokensLocWidthPlusOne (tokens []Token ) int {
200209 locWidth := 0
201210 for _ , token := range tokens {
202211 // TODO: Loc.String() should include the extra ":", but that requires a huge refactoring in all the places where call it explicitly or implicitly
@@ -206,7 +215,7 @@ func MaxLocWidthPlusOne(tokens []Token) int {
206215}
207216
208217func PrintFlagsSummary (flags []Token ) {
209- locWidth := MaxLocWidthPlusOne (flags )
218+ locWidth := MaxTokensLocWidthPlusOne (flags )
210219 // TODO: merge together parameters defined on the same line
211220 for _ , flag := range flags {
212221 fmt .Printf ("%-*s %s\n " , locWidth , flag .Loc .String () + ":" , string (flag .Text ))
@@ -249,7 +258,7 @@ func (context EvalContext) PrintSummary() error {
249258 TwitchVodFileRegexp := "([0-9]+)-[0-9a-f\\ -]+\\ .mp4"
250259 re := regexp .MustCompile (TwitchVodFileRegexp )
251260 fmt .Printf (">>> Twitch Chat Logs (Detected by regex `%s`)\n " , TwitchVodFileRegexp )
252- locWidth := MaxLocWidthPlusOne (context .inputPathLog )
261+ locWidth := MaxTokensLocWidthPlusOne (context .inputPathLog )
253262 for _ , inputPath := range context .inputPathLog {
254263 match := re .FindStringSubmatch (string (inputPath .Text ))
255264 if len (match ) > 0 {
@@ -259,13 +268,14 @@ func (context EvalContext) PrintSummary() error {
259268 }
260269 }
261270 fmt .Println ()
271+ locWidth = MaxChunksLocWidthPlusOne (context .chunks )
262272 fmt .Printf (">>> Cuts (%d):\n " , max (len (context .chunks )- 1 , 0 ))
263273 var fullLength Millis = 0
264274 var finishedLength Millis = 0
265275 var renderedLength Millis = 0
266276 for i , chunk := range context .chunks {
267277 if i < len (context .chunks )- 1 {
268- fmt .Printf ("%s: Cut %d - %s\n " , chunk .Loc , i , millisToTs (fullLength + chunk .Duration ()))
278+ fmt .Printf ("%-*s Cut %d - %s\n " , locWidth , chunk .Loc . String () + ":" , i , millisToTs (fullLength + chunk .Duration ()))
269279 }
270280 fullLength += chunk .Duration ()
271281 if ! chunk .Unfinished {
@@ -286,7 +296,7 @@ func (context EvalContext) PrintSummary() error {
286296 if rendered {
287297 checkMark = "[x]"
288298 }
289- fmt .Printf ("%s: %s Chunk %d - %s -> %s (Duration: %s)\n " , chunk .Loc , checkMark , index , millisToTs (chunk .Start ), millisToTs (chunk .End ), millisToTs (chunk .Duration ()))
299+ fmt .Printf ("%-*s %s Chunk %d - %s -> %s (Duration: %s)\n " , locWidth , chunk .Loc . String () + ":" , checkMark , index , millisToTs (chunk .Start ), millisToTs (chunk .End ), millisToTs (chunk .Duration ()))
290300 // TODO: Print extra output flags of the chunk
291301 }
292302 fmt .Println ()
0 commit comments