subTasks method

  1. @override
List<HookTask> subTasks(
  1. Iterable<String> filePaths
)
override

Gets the list of sub-tasks for the given file paths.

filePaths is the list of file paths to process.

Implementation

@override
List<HookTask> subTasks(Iterable<String> filePaths) {
  final paths = switch (workingDirectory) {
    final String cwd => [
      for (final path in filePaths)
        if (fs.path.isWithin(cwd, path))
          fs.path.relative(path, from: cwd)
        else
          path,
    ],
    null => filePaths.toList(),
  };

  return [
    for (final (index, command) in _commands(paths).indexed)
      switch (_always) {
        true => _OneShellTask.always,
        false => _OneShellTask.new,
      }(command: command, index: index),
  ];
}