envrcFilepathsGenerator function

FigGenerator envrcFilepathsGenerator({
  1. bool isDangerous = false,
})

Implementation

FigGenerator envrcFilepathsGenerator({bool isDangerous = false}) {
  return FigGenerator(
    template: 'filepaths',
    filterTemplateSuggestions: (List<FigSuggestion> paths) {
      bool isEnvrc(String fileName) => fileName.contains('.envrc');
      return paths.where((file) {
        final name = file.name;
        if (name == null) return false;
        return isEnvrc(name) || name.endsWith('/');
      }).map((file) {
        final name = file.name!;
        int? priority;
        if (isEnvrc(name)) {
          priority = priorityTopThreshold;
        }
        return _copySuggestion(
          file,
          priority: priority,
          isDangerous: isDangerous,
        );
      }).toList();
    },
  );
}