label method

Iterable<String?> label(
  1. String? loading
)

Implementation

Iterable<String?> label(
  String? loading,
) sync* {
  yield 'Running tasks for $nameOfHook';

  if (debug) {
    final PendingHook(
      :isDead,
      :wasKilled,
      :completedTasks,
      :startedTasks,
    ) = pendingHook;
    yield darkGray.wrap('');
    yield darkGray.wrap('Started Tasks: ${startedTasks.join(', ')}');
    yield darkGray.wrap('Completed Tasks: ${completedTasks.join(', ')}');
    yield darkGray.wrap('Killed: $wasKilled');
    yield darkGray.wrap('Dead: $isDead');
  }

  for (final task in pendingHook.topLevelTasks) {
    final PendingTask(
      resolvedTask: ResolvedHookTask(
        label: TaskLabel(:depth),
      ),
      :isError,
      :isHalted,
      :isRunning,
      :hasStarted,
      :hasCompleted
    ) = task;

    if (debug) {
      yield '';
      yield darkGray.wrap('Total depth: $depth');
      final status = switch ('') {
        _ when isRunning => 'Running',
        _ when isHalted => 'Halted',
        _ when isError => 'Error',
        _ when hasStarted => 'Started',
        _ when hasCompleted => 'Completed',
        _ when task.files.isEmpty => 'Skipped',
        _ when !isRunning => 'Pending',
        _ => '???',
      };
      yield darkGray.wrap('Status: $status');
    }
    yield* retrieveLabels(
      task,
      loading: loading,
      spacing: spacer,
    );
  }

  yield '\n';
}