- (BOOL) tabs;
- (NSString *) others;
- (BOOL) with_terminal;
+- (NSString *) scriptargs;
@end
@interface FileSettings : NSObject <FileSettingsSource>
BOOL nosite; // -S option: don't import site.py
BOOL tabs; // -t option: warn about inconsistent tabs
NSString *others; // other options
+ NSString *scriptargs; // script arguments (not for preferences)
BOOL with_terminal; // Run in terminal window
FileSettings *origsource;
nosite = source->nosite;
tabs = source->tabs;
others = [source->others retain];
+ scriptargs = [source->scriptargs retain];
with_terminal = source->with_terminal;
prefskey = source->prefskey;
if (prefskey) [prefskey retain];
self = [self initWithFileSettings: fsdefaults];
if (!self) return self;
interpreters = [fsdefaults->interpreters retain];
+ scriptargs = [@"" retain];
[self applyUserDefaults: filetype];
prefskey = [filetype retain];
return self;
nosite = [source nosite];
tabs = [source tabs];
others = [[source others] retain];
+ scriptargs = [[source scriptargs] retain];
with_terminal = [source with_terminal];
// And if this is a user defaults object we also save the
// values
[NSNumber numberWithBool: nosite], @"nosite",
[NSNumber numberWithBool: nosite], @"nosite",
others, @"others",
+ scriptargs, @"scriptargs",
[NSNumber numberWithBool: with_terminal], @"with_terminal",
nil];
defaults = [NSUserDefaults standardUserDefaults];
if (value) tabs = [value boolValue];
value = [dict objectForKey: @"others"];
if (value) others = [value retain];
+ value = [dict objectForKey: @"scriptargs"];
+ if (value) scriptargs = [value retain];
value = [dict objectForKey: @"with_terminal"];
if (value) with_terminal = [value boolValue];
}
cur_interp = interpreter;
return [NSString stringWithFormat:
- @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %s",
+ @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %@ %s",
cur_interp,
debug?" -d":"",
verbose?" -v":"",
tabs?" -t":"",
others,
script,
+ scriptargs,
with_terminal? "&& echo Exit status: $? && exit 1" : " &"];
}
- (BOOL) nosite { return nosite;};
- (BOOL) tabs { return tabs;};
- (NSString *) others { return others;};
+- (NSString *) scriptargs { return scriptargs;};
- (BOOL) with_terminal { return with_terminal;};
@end
[nosite setState: [settings nosite]];
[tabs setState: [settings tabs]];
[others setStringValue: [settings others]];
+ [scriptargs setStringValue: [settings scriptargs]];
[with_terminal setState: [settings with_terminal]];
[commandline setStringValue: [settings commandLineForScript: script]];
- (BOOL) nosite { return [nosite state];};
- (BOOL) tabs { return [tabs state];};
- (NSString *) others { return [others stringValue];};
+- (NSString *) scriptargs { return [scriptargs stringValue];};
- (BOOL) with_terminal { return [with_terminal state];};
// Delegates
[tabs setState: [settings tabs]];
[others setStringValue: [settings others]];
[with_terminal setState: [settings with_terminal]];
+ // Not scriptargs, it isn't for preferences
[commandline setStringValue: [settings commandLineForScript: @"<your script here>"]];
}
- (BOOL) tabs { return [tabs state];};
- (NSString *) others { return [others stringValue];};
- (BOOL) with_terminal { return [with_terminal state];};
+- (NSString *) scriptargs { return @"";};
// Delegates
- (void)controlTextDidChange:(NSNotification *)aNotification