MCPcopy Index your code
hub / github.com/codechenx/FastTableViewer / display

Method display

io.go:54–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52}
53
54func (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
78func (p *progressTracker) finish() {
79 if !p.showProgress {

Callers 1

incrementMethod · 0.95

Calls 1

makeProgressBarFunction · 0.85

Tested by

no test coverage detected