()
| 52 | } |
| 53 | |
| 54 | func (p *progressTracker) display() { |
| 55 | if !p.showProgress { |
| 56 | return |
| 57 | } |
| 58 | |
| 59 | elapsed := time.Since(p.startTime).Seconds() |
| 60 | if elapsed == 0 { |
| 61 | elapsed = 0.001 // avoid division by zero |
| 62 | } |
| 63 | linesPerSec := float64(p.lineCount) / elapsed |
| 64 | |
| 65 | if p.total > 0 { |
| 66 | percent := float64(p.current) * 100.0 / float64(p.total) |
| 67 | if percent > 100 { |
| 68 | percent = 100 |
| 69 | } |
| 70 | progressBar := makeProgressBar(percent, 20) |
| 71 | fmt.Printf("\r\033[K📊 Loading: %s | %d lines | %.0f lines/sec", progressBar, p.lineCount, linesPerSec) |
| 72 | } else { |
| 73 | // For pipes or when size is unknown |
| 74 | fmt.Printf("\r\033[K📊 Loading: %d lines | %.0f lines/sec", p.lineCount, linesPerSec) |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | func (p *progressTracker) finish() { |
| 79 | if !p.showProgress { |
no test coverage detected