commandsToRun method

Iterable<CommandsToRunResult> commandsToRun(
  1. List<String> keys, {
  2. required bool listOut,
})

Implementation

Iterable<CommandsToRunResult> commandsToRun(
  List<String> keys, {
  required bool listOut,
}) sync* {
  var bail = false;

  final allResults = getCommands(keys, listOut: listOut);
  for (final result in allResults) {
    final GetCommandsResult(:exitCode, :script, :resolveScript) = result;

    if (exitCode != null || script == null) {
      yield CommandsToRunResult.fail(
        exitCode,
        bail: script?.bail ?? bail,
      );

      return;
    }

    bail ^= script.bail;

    assert(resolveScript != null, 'commands should not be null');
    yield CommandsToRunResult(
      commands: _commandsToRun(result),
      bail: bail,
      combinedEnvConfig: resolveScript?.envConfig,
    );
  }
}