run method
void
run()
Implementation
void run() {
final dir = Directory(folderPath);
if (!dir.existsSync()) {
print('Error: Folder does not exist at $folderPath');
return;
}
_progress.start('Scanning for JSON files...');
final files = dir.listSync().whereType<File>().where((file) => p.extension(file.path) == '.json').toList();
if (files.isEmpty) {
_progress.error('No JSON files found in $folderPath');
return;
}
_progress.success('${files.length} JSON files detected');
print('\nš Batch generation started');
print('-----------------------------------------');
for (var file in files) {
final fileName = p.basenameWithoutExtension(file.path);
final modelName = StringUtils.capitalize(StringUtils.snakeToCamel(fileName));
try {
_progress.start('Processing: $fileName.json -> $modelName');
final json = JsonParser.parseFile(file.path);
_generateForFile(json, modelName);
_progress.success('Generated: $modelName');
} catch (e) {
_progress.error('Failed to process ${file.path}: $e');
}
}
_printSummary();
_progress.printFinalSuccess('Batch generation complete');
}