formatReport method

String formatReport()

Implementation

String formatReport() {
  final buf = StringBuffer();
  buf.writeln(
    'Bootstrap ${status.name} in ${totalDuration.inMilliseconds}ms',
  );
  buf.writeln('Steps:');
  for (final step in steps) {
    final icon = switch (step.status) {
      BootstrapStepStatus.completed => '+',
      BootstrapStepStatus.skipped => '-',
      BootstrapStepStatus.failed => 'x',
      _ => '?',
    };
    buf.writeln('  [$icon] ${step.name} (${step.duration.inMilliseconds}ms)');
    if (step.error != null) buf.writeln('      Error: ${step.error}');
    if (step.warning != null) buf.writeln('      Warn: ${step.warning}');
  }
  if (warnings.isNotEmpty) {
    buf.writeln('Warnings:');
    for (final w in warnings) {
      buf.writeln('  - $w');
    }
  }
  if (errors.isNotEmpty) {
    buf.writeln('Errors:');
    for (final e in errors) {
      buf.writeln('  - $e');
    }
  }
  return buf.toString();
}