call method

List<String> call({
  1. required List<String> filePaths,
  2. required List<String> fileContentToExclude,
})

Removes filePaths of files containing content of any given fileContentToExclude entries.

Implementation

List<String> call({
  required List<String> filePaths,
  required List<String> fileContentToExclude,
}) {
  final mutableFilePaths = List<String>.from(filePaths);

  final contentPatterns = fileContentToExclude
      .map((pattern) => pattern.replaceAll('*', r'[\S\s]*'))
      .map((pattern) => RegExp(pattern))
      .toList(growable: false);

  mutableFilePaths.removeWhere((filePath) => _containsContent(
        file: File(filePath),
        patterns: contentPatterns,
      ));

  return mutableFilePaths;
}