update method
Called about once a second and after every state change.
Implementation
@override
void update(ProgressTracker t) {
if (!_announced) {
_announced = true;
stdout.writeln(_style.bold(' ${_headline(t)}'));
}
final now = t.now;
for (var i = 0; i < t.jobs.length; i++) {
final j = t.jobs[i];
if (_lastState[i] == j.state) continue;
_lastState[i] = j.state;
final name = '${j.job.label} (${j.job.types})';
final pct = '${t.percentLabel(now)}%';
switch (j.state) {
case JobState.queued:
break;
case JobState.running:
stdout.writeln(
' ▶ started $name · ~${formatDuration(j.estimate)} expected');
case JobState.succeeded:
stdout.writeln(_style.green(' ✓ ') +
'$name done in ${formatDuration(j.elapsed(now))} · $pct · ${_etaText(t)}');
case JobState.failed:
stdout.writeln(_style.red(' ✗ ') +
'$name failed${j.detail != null ? ': ${j.detail}' : ''} · $pct · ${_etaText(t)}');
case JobState.skipped:
stdout.writeln(
' – skipped $name${j.detail != null ? ': ${j.detail}' : ''}');
}
}
if (_lastStatus == null || now.difference(_lastStatus!) >= interval) {
_lastStatus = now;
final running = t.jobs.where((j) => j.state == JobState.running).map((j) =>
'${j.job.label} ${math.min(99, (100 * j.fraction(now)).floor())}%${j.step != null ? ' (${j.step})' : ''}');
if (running.isNotEmpty) {
stdout.writeln(_style.dim(
' … ${t.percentLabel(now)}% · ${_etaText(t)} · ${running.join(' · ')}'));
}
}
}