mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
gitx CLI: Add option to find git path
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user