GenConfig.withDefaults constructor

GenConfig.withDefaults([
  1. String? workingDir
])

Create config with sensible defaults

Implementation

factory GenConfig.withDefaults([String? workingDir]) {
  final dir = workingDir ?? Directory.current.path;
  final detectedType = LanguageConfig.detectProjectType(dir);
  final langConfig = LanguageConfig.forType(detectedType);

  // Find the first existing source directory
  String sourceDir = '.';
  for (final candidate in langConfig.defaultSourceDirs) {
    if (Directory(p.join(dir, candidate)).existsSync()) {
      sourceDir = candidate;
      break;
    }
  }

  return GenConfig(
    sourceDir: sourceDir,
    outputPrefix: 'CLAUDIO',
    targetSizeKB: 1000,
    removeComments: true,
    projectTypeName: detectedType.name,
    extensions: const [],
    ignorePatterns: const [],
    ignoreFiles: const [],
    extraRootFiles: _defaultExtraRootFiles(detectedType),
    outputFormatName: 'text',
    verbose: false,
  );
}