* Create a plain-text progress callback for --verbose mode. * No animations, no ANSI tricks — just timestamped lines to stdout.
()
| 255 | * No animations, no ANSI tricks — just timestamped lines to stdout. |
| 256 | */ |
| 257 | function createVerboseProgress(): (progress: { phase: string; current: number; total: number; currentFile?: string }) => void { |
| 258 | let lastPhase = ''; |
| 259 | let lastPct = -1; |
| 260 | const startTime = Date.now(); |
| 261 | |
| 262 | return (progress) => { |
| 263 | const elapsed = ((Date.now() - startTime) / 1000).toFixed(1); |
| 264 | |
| 265 | if (progress.phase !== lastPhase) { |
| 266 | lastPhase = progress.phase; |
| 267 | lastPct = -1; |
| 268 | console.log(`[${elapsed}s] Phase: ${progress.phase}`); |
| 269 | } |
| 270 | |
| 271 | if (progress.total > 0) { |
| 272 | const pct = Math.floor((progress.current / progress.total) * 100); |
| 273 | // Log every 5% to keep output manageable |
| 274 | if (pct >= lastPct + 5 || progress.current === progress.total) { |
| 275 | lastPct = pct; |
| 276 | console.log(`[${elapsed}s] ${progress.current}/${progress.total} (${pct}%)${progress.currentFile ? ` ${getGlyphs().dash} ${progress.currentFile}` : ''}`); |
| 277 | } |
| 278 | } else if (progress.current > 0) { |
| 279 | // Scanning phase (no total yet) — log periodically |
| 280 | if (progress.current % 1000 === 0 || progress.current === 1) { |
| 281 | console.log(`[${elapsed}s] ${formatNumber(progress.current)} files found`); |
| 282 | } |
| 283 | } |
| 284 | }; |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * Print success message |
no test coverage detected