diff --git a/mogenerator.h b/mogenerator.h index 1d5761d8..5aed9c97 100644 --- a/mogenerator.h +++ b/mogenerator.h @@ -67,6 +67,7 @@ NSString *baseClass; NSString *baseClassImport; NSString *baseClassForce; + NSString *ignoredEntities; NSString *includem; NSString *includeh; NSString *templatePath; diff --git a/mogenerator.m b/mogenerator.m index 241621cf..0139e1d4 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -796,6 +796,7 @@ - (void)application:(DDCliApplication*)app {@"base-class", 0, DDGetoptRequiredArgument}, {@"base-class-import", 0, DDGetoptRequiredArgument}, {@"base-class-force", 0, DDGetoptRequiredArgument}, + {@"ignored-entities", 0, DDGetoptRequiredArgument}, // For compatibility: {@"baseClass", 0, DDGetoptRequiredArgument}, {@"includem", 0, DDGetoptRequiredArgument}, @@ -850,6 +851,7 @@ - (void)printUsage { "--base-class-force CLASS Same as --base-class except will force all entities to\n" " have the specified base class. Even if a super entity\n" " exists\n" + "--ignored-entities LIST Comma separated list of of entity names. Entities will be ignored when generating classes\n" "--includem FILE Generate aggregate include file for .m files for both\n" " human and machine generated source files\n" "--includeh FILE Generate aggregate include file for .h files for human\n" @@ -1046,6 +1048,11 @@ - (void)validateOutputPath:(NSString*)path forType:(NSString*)type } } +- (BOOL)isIgnoredEntity:(NSString *)entityName { + NSArray *entities = [ignoredEntities componentsSeparatedByString:@","]; + return [entities containsObject:entityName] || [entities containsObject:[NSString stringWithFormat:@"_%@", entityName]]; +} + - (int)application:(DDCliApplication*)app runWithArguments:(NSArray*)arguments { if (_help) { [self printUsage]; @@ -1192,6 +1199,9 @@ - (int)application:(DDCliApplication*)app runWithArguments:(NSArray*)arguments { NSArray *entitiesWithCustomSubclass = [model entitiesWithACustomSubclassInConfiguration:configuration verbose:YES]; for (NSEntityDescription *entity in entitiesWithCustomSubclass) { + if ([self isIgnoredEntity:entity.name]) { + continue; + } NSString *generatedMachineH = [machineH executeWithObject:entity sender:nil]; NSString *generatedMachineM = [machineM executeWithObject:entity sender:nil]; NSString *generatedHumanH = [humanH executeWithObject:entity sender:nil];