in internal/utils/out.go [25:61]
func ProgressTicker(headline string, wg *sync.WaitGroup, ch <-chan bool) {
wg.Add(1)
defer wg.Done()
ticker := time.NewTicker(
5 * time.Second,
) // TODO: this falsely lengthens then wait block by 5 seconds minimum
defer ticker.Stop()
startTime := time.Now()
for {
select {
case <-ch:
return
case <-ticker.C:
elapsed := time.Since(startTime)
minutes := int(elapsed.Minutes())
seconds := int(elapsed.Seconds()) - minutes*60
if minutes == 0 {
fmt.Printf(
"Still working on %s for %d seconds\n",
headline,
seconds,
)
} else {
fmt.Printf(
"Still working on %s for %d minutes and %d seconds\n",
headline,
minutes,
seconds,
)
}
}
}
}