* Create a plain-text progress callback for --verbose mode. * No animations, no ANSI tricks — just timestamped lines to stdout.
()
| 320 | * No animations, no ANSI tricks — just timestamped lines to stdout. |
| 321 | */ |
| 322 | function createVerboseProgress(): (progress: { phase: string; current: number; total: number; currentFile?: string }) => void { |
| 323 | let lastPhase = ''; |
| 324 | let lastPct = -1; |
| 325 | const startTime = Date.now(); |
| 326 | |
| 327 | return (progress) => { |
| 328 | const elapsed = ((Date.now() - startTime) / 1000).toFixed(1); |
| 329 | |
| 330 | if (progress.phase !== lastPhase) { |
| 331 | lastPhase = progress.phase; |
| 332 | lastPct = -1; |
| 333 | console.log(`[${elapsed}s] Phase: ${progress.phase}`); |
| 334 | } |
| 335 | |
| 336 | if (progress.total > 0) { |
| 337 | const pct = Math.floor((progress.current / progress.total) * 100); |
| 338 | // Log every 5% to keep output manageable |
| 339 | if (pct >= lastPct + 5 || progress.current === progress.total) { |
| 340 | lastPct = pct; |
| 341 | console.log(`[${elapsed}s] ${progress.current}/${progress.total} (${pct}%)${progress.currentFile ? ` ${getGlyphs().dash} ${progress.currentFile}` : ''}`); |
| 342 | } |
| 343 | } else if (progress.current > 0) { |
| 344 | // Scanning phase (no total yet) — log periodically |
| 345 | if (progress.current % 1000 === 0 || progress.current === 1) { |
| 346 | console.log(`[${elapsed}s] ${formatNumber(progress.current)} files found`); |
| 347 | } |
| 348 | } |
| 349 | }; |
| 350 | } |
| 351 | |
| 352 | /** |
| 353 | * Print success message |
no test coverage detected