-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
• add ‘prototype’ command ("$DIALOG" help prototype)
This was previously the ‘--prototype’ argument to ‘nib’ (which is now removed). git-svn-id: http://svn.textmate.org/trunk/Tools/Dialog@11531 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
- Loading branch information
Showing
5 changed files
with
70 additions
and
23 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#import "TMDChameleon.h" | ||
#import "../../Dialog2.h" | ||
#import "../../TMDCommand.h" | ||
|
||
@interface TMDPrototype : TMDCommand | ||
{ | ||
} | ||
@end | ||
|
||
@implementation TMDPrototype | ||
+ (void)load | ||
{ | ||
[TMDPrototype registerObject:[self new] forCommand:@"prototype"]; | ||
} | ||
|
||
- (void)handleCommand:(CLIProxy*)proxy | ||
{ | ||
NSDictionary* args = [proxy parameters]; | ||
|
||
if(NSDictionary* values = [args objectForKey:@"register"]) | ||
{ | ||
// FIXME this is needed only because we presently can’t express argument constraints (CLIProxy would otherwise correctly validate/convert CLI arguments) | ||
if([values isKindOfClass:[NSString class]]) | ||
values = [NSPropertyListSerialization propertyListFromData:[(NSString*)values dataUsingEncoding:NSUTF8StringEncoding] mutabilityOption:NSPropertyListImmutable format:nil errorDescription:NULL]; | ||
|
||
enumerate([values allKeys], id key) | ||
[TMDChameleon createSubclassNamed:key withValues:[values objectForKey:key]]; | ||
} | ||
|
||
if(NSString* show = [args objectForKey:@"show"]) | ||
{ | ||
id obj = [[NSClassFromString(show) new] autorelease]; | ||
[proxy writeStringToOutput:[obj description] ?: [NSString stringWithFormat:@"error: no class named ‘%@’", show]]; | ||
[proxy writeStringToOutput:@"\n"]; | ||
} | ||
} | ||
|
||
- (NSString *)commandDescription | ||
{ | ||
return @"Register classes for use with NSArrayController."; | ||
} | ||
|
||
- (NSString *)usageForInvocation:(NSString *)invocation; | ||
{ | ||
return [NSString stringWithFormat:@"\t%1$@ --register \"{ SQL_New_Connection = { title = untitled; serverType = MySQL; hostName = localhost; userName = '$LOGNAME'; }; }\"\n\t%1$@ --show SQL_New_Connection\n", invocation]; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters