mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
CLI: allow passing of command line arguments
This commit is contained in:
+1
-1
@@ -20,5 +20,5 @@
|
||||
#define PBCLIProxyErrorDomain @"PBCLIProxyErrorDomain"
|
||||
|
||||
@protocol GitXCliToolProtocol
|
||||
- (BOOL)openRepository:(NSURL*)repositoryPath error:(NSError**)error;
|
||||
- (BOOL)openRepository:(NSURL*)repositoryPath arguments: (NSArray*) args error:(NSError**)error;
|
||||
@end
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)openRepository:(NSURL*)repositoryPath error:(NSError**)error;
|
||||
- (BOOL)openRepository:(NSURL*)repositoryPath arguments: (NSArray*) args error:(NSError**)error;
|
||||
{
|
||||
// FIXME I found that creating this redundant NSURL reference was necessary to
|
||||
// work around an apparent bug with GC and Distributed Objects
|
||||
|
||||
@@ -16,7 +16,7 @@ NSDistantObject* connect()
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char* argv)
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
// Attempt to connect to the app
|
||||
id proxy = connect();
|
||||
@@ -38,9 +38,16 @@ int main(int argc, const char* argv)
|
||||
}
|
||||
|
||||
if ([[[NSProcessInfo processInfo] environment] objectForKey:@"PWD"]) {
|
||||
int i;
|
||||
argv++; argc--;
|
||||
NSURL* url = [NSURL fileURLWithPath:[[[NSProcessInfo processInfo] environment] objectForKey:@"PWD"]];
|
||||
|
||||
NSMutableArray* arguments = [NSMutableArray arrayWithCapacity:argc];
|
||||
for (i = 0; i < argc; i++)
|
||||
[arguments addObject: [NSString stringWithCString:argv[i]]];
|
||||
|
||||
NSError* error = nil;
|
||||
if (![proxy openRepository:url error:&error]) {
|
||||
if (![proxy openRepository:url arguments: arguments error:&error]) {
|
||||
fprintf(stderr, "Error opening repository at %s", [[url path] UTF8String]);
|
||||
if (error) {
|
||||
fprintf(stderr, ": %s", [[error localizedFailureReason] UTF8String]);
|
||||
|
||||
Reference in New Issue
Block a user