Skip to content

Commit eb7d127

Browse files
author
Chaitanya Gupta
committed
Start using MOMCompiler.
Now we take a .xcdatamodel file as input, compile it to a .mom file, and print its contents on screen.
1 parent e84f6ad commit eb7d127

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/main.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//
88

99
#import <Foundation/Foundation.h>
10+
#import "utils.h"
11+
#import "MOMCompiler.h"
1012
#import "MOMPrinter.h"
1113

1214
int main(int argc, const char * argv[])
@@ -15,8 +17,18 @@ int main(int argc, const char * argv[])
1517
@autoreleasepool {
1618
if (argc == 2) {
1719
NSString *path = [NSString stringWithCString:argv[1] encoding:NSUTF8StringEncoding];
20+
MOMCompiler *compiler = [[[MOMCompiler alloc] init] autorelease];
21+
NSString *compiledPath = [compiler compilePath:path];
22+
if (compiledPath == nil) {
23+
return 2;
24+
}
1825
MOMPrinter *printer = [[[MOMPrinter alloc] init] autorelease];
19-
[printer printPath:path];
26+
if (![printer printPath:compiledPath]) {
27+
return 2;
28+
}
29+
} else {
30+
NSPrintf(@"Usage: %@ path_to_xcdatamodel_file\n", [[NSProcessInfo processInfo] processName]);
31+
return 1;
2032
}
2133
}
2234
return 0;

0 commit comments

Comments
 (0)