mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 15:30:18 +00:00
17f50e3f7e
Allows creating repositories from the command line, Applescript, or the scripting bridge. These are basic commands, if you need to use commandline options then use git itself.
50 lines
1.4 KiB
Objective-C
50 lines
1.4 KiB
Objective-C
//
|
|
// 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
|