mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Add --init and --clone to gitx CLI and Applescript
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.
This commit is contained in:
@@ -47,6 +47,16 @@
|
||||
return document;
|
||||
}
|
||||
|
||||
- (void)initNewRepositoryAtURL:(NSURL *)url
|
||||
{
|
||||
int terminationStatus;
|
||||
NSString *result = [PBEasyPipe outputForCommand:[PBGitBinary path] withArgs:[NSArray arrayWithObjects:@"init", @"-q", nil] inDir:[url path] retValue:&terminationStatus];
|
||||
|
||||
if (terminationStatus == 0)
|
||||
[self openDocumentWithContentsOfURL:url display:YES error:NULL];
|
||||
else
|
||||
NSRunAlertPanel(@"Failed to create new Git repository", @"Git returned the following error when trying to create the repository: %@", nil, nil, nil, result);
|
||||
}
|
||||
|
||||
- (IBAction)newDocument:(id)sender
|
||||
{
|
||||
@@ -58,16 +68,7 @@
|
||||
[op setMessage:@"Initialize a repository here:"];
|
||||
[op setTitle:@"New Repository"];
|
||||
if ([op runModal] == NSFileHandlingPanelOKButton)
|
||||
{
|
||||
NSString *path = [op filename];
|
||||
int terminationStatus;
|
||||
NSString *result = [PBEasyPipe outputForCommand:[PBGitBinary path] withArgs:[NSArray arrayWithObjects:@"init", @"-q", nil] inDir:path inputString:nil retValue:&terminationStatus];
|
||||
|
||||
if (terminationStatus == 0)
|
||||
[self openDocumentWithContentsOfURL:[op URL] display:YES error:NULL];
|
||||
else
|
||||
NSRunAlertPanel(@"Failed to create new Git repository", @"Git returned the following error when trying to create the repository: %@", nil, nil, nil, result);
|
||||
}
|
||||
[self initNewRepositoryAtURL:[op URL]];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user