Permalink
Browse files

Got rid of the -e arg for the jstalk REPL. Seems alright to just drop…

… into it if there are no args.
  • Loading branch information...
1 parent 56fa38e commit 1a90c9af6f4a816faaa65aac6d206ee32be50718 @ccgus committed Nov 30, 2010
Showing with 8 additions and 9 deletions.
  1. +8 −9 src/jstalkmain.m
View
@@ -57,30 +57,29 @@ void runREPL(JSTalk *t) {
int main(int argc, char *argv[]) {
- if (argc < 2) {
- printf("usage: %s <path to file>\n", argv[0]);
- return 1;
- }
-
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- NSString *arg = [NSString stringWithUTF8String:argv[1]];
-
JSCErrorHandler *eh = [[[JSCErrorHandler alloc] init] autorelease];
JSTalk *t = [[[JSTalk alloc] init] autorelease];
JSCocoaController *jsController = [t jsController];
jsController.delegate = eh;
-
- if ([arg isEqualToString:@"-e"]) {
+ if (argc < 2) {
runREPL(t);
exit(0);
}
+
+ NSString *arg = [NSString stringWithUTF8String:argv[1]];
NSString *s = [NSString stringWithContentsOfFile:arg encoding:NSUTF8StringEncoding error:nil];
+ if (!s) {
+ printf("usage: %s <path to file>\n", argv[0]);
+ exit(0);
+ }
+
[t.env setObject:[NSURL fileURLWithPath:arg] forKey:@"scriptURL"];
if ([s hasPrefix:@"#!"]) {

0 comments on commit 1a90c9a

Please sign in to comment.