27 lines
509 B
TypeScript
27 lines
509 B
TypeScript
/**
|
|
* Simple progress tracker for pipeline execution.
|
|
*/
|
|
export class ProgressTracker {
|
|
private current: number;
|
|
private failed: number;
|
|
private total: number;
|
|
|
|
constructor(total: number) {
|
|
this.current = 0;
|
|
this.failed = 0;
|
|
this.total = total;
|
|
}
|
|
|
|
next(): number {
|
|
this.current++;
|
|
return this.current;
|
|
}
|
|
|
|
recordFailed(): void {
|
|
this.failed++;
|
|
}
|
|
|
|
format(label: string): string {
|
|
return `[${this.current}/${this.total}] (${this.failed} failed) ${label}`;
|
|
}
|
|
}
|