gitx CLI: Add option to find git path

This commit is contained in:
Pieter de Bie
2009-03-24 14:21:41 +00:00
parent b4d93988ed
commit af40162a83
+12
View File
@@ -74,6 +74,16 @@ void version_info()
exit(1);
}
void git_path()
{
if (![PBGitBinary path])
exit(101);
NSString *path = [[PBGitBinary path] stringByDeletingLastPathComponent];
printf("%s", [path UTF8String]);
exit(0);
}
void handleSTDINDiff(id<GitXCliToolProtocol> proxy)
{
NSFileHandle *handle = [NSFileHandle fileHandleWithStandardInput];
@@ -106,6 +116,8 @@ int main(int argc, const char** argv)
usage(argv[0]);
if (argc >= 2 && (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")))
version_info();
if (argc >= 2 && !strcmp(argv[1], "--git-path"))
git_path();
if (![PBGitBinary path]) {
printf("%s\n", [[PBGitBinary notFoundError] cStringUsingEncoding:NSUTF8StringEncoding]);