forked from laullon/gitx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NSApplication+GitXScripting.m
49 lines (41 loc) · 1.41 KB
/
NSApplication+GitXScripting.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// NSApplication+GitXScripting.m
// GitX
//
// Created by Nathan Kinsinger on 8/15/10.
// Copyright 2010 Nathan Kinsinger. All rights reserved.
//
#import "NSApplication+GitXScripting.h"
#import "GitXScriptingConstants.h"
#import "PBDiffWindowController.h"
#import "PBRepositoryDocumentController.h"
#import "PBCloneRepositoryPanel.h"
@implementation NSApplication (GitXScripting)
- (void)showDiffScriptCommand:(NSScriptCommand *)command
{
NSString *diffText = [command directParameter];
if (diffText) {
PBDiffWindowController *diffController = [[PBDiffWindowController alloc] initWithDiff:diffText];
[diffController showWindow:nil];
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
}
}
- (void)initRepositoryScriptCommand:(NSScriptCommand *)command
{
NSURL *repositoryURL = [command directParameter];
if (repositoryURL)
[[PBRepositoryDocumentController sharedDocumentController] initNewRepositoryAtURL:repositoryURL];
}
- (void)cloneRepositoryScriptCommand:(NSScriptCommand *)command
{
NSString *repository = [command directParameter];
if (repository) {
NSDictionary *arguments = [command arguments];
NSURL *destinationURL = [arguments objectForKey:kGitXCloneDestinationURLKey];
if (destinationURL) {
BOOL isBare = [[arguments objectForKey:kGitXCloneIsBareKey] boolValue];
[PBCloneRepositoryPanel beginCloneRepository:repository toURL:destinationURL isBare:isBare];
}
}
}
@end