public static void DrawPackageDownUpButton(GitLinkOnDisk disk, bool affectPackage = true) { if (!disk.HasUrl()) { return; } bool isDirectoryCreated = Directory.Exists(disk.GetDirectoryPath()); bool isGitFolderPresent = disk.HasUrl(); GUIStyle disableStyle = GetDisableStyle(); GUIStyle enableStyle = GetEnableStyle(); GUILayout.BeginHorizontal(); bool downAllow = true; if (GUILayout.Button("Down", downAllow ? enableStyle : disableStyle)) { UnityPackageUtility.Down(disk.GetDirectoryPath(), disk.GetUrl(), affectPackage); } bool upAllow = isDirectoryCreated && isGitFolderPresent; if (GUILayout.Button("Up", upAllow ? enableStyle : disableStyle)) { if (upAllow) { UnityPackageUtility.Up(disk.GetDirectoryPath(), affectPackage); } } GUILayout.EndHorizontal(); }
public static void DisplayGitCommands(GitLinkOnDisk gitDirectory) { bool hasUrl = gitDirectory.HasUrl(); if (gitDirectory.Exist()) { GUILayout.BeginHorizontal(); if (GUILayout.Button("Add -a")) { QuickGit.Add(gitDirectory.GetDirectoryPath()); } if (GUILayout.Button("Commit")) { QuickGit.Commit(gitDirectory.GetDirectoryPath()); } if (hasUrl && GUILayout.Button("Pull")) { QuickGit.Pull(gitDirectory.GetDirectoryPath()); } if (hasUrl && GUILayout.Button("Push")) { QuickGit.Push(gitDirectory.GetDirectoryPath()); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (hasUrl && GUILayout.Button("Add>Commit>Pull")) { QuickGit.AddCommitAndPush(gitDirectory.GetDirectoryPath()); } if (hasUrl && GUILayout.Button("A>C>Pull + A>C>push")) { QuickGit.PullPushWithAddAndCommit(gitDirectory.GetDirectoryPath()); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Open explorer")) { Application.OpenURL(gitDirectory.GetDirectoryPath()); } if (GUILayout.Button("See Status")) { QuickGit.OpenCmd(gitDirectory.GetDirectoryPath()); } if (hasUrl && GUILayout.Button("Go to Server")) { Application.OpenURL(gitDirectory.GetUrl()); } GUILayout.EndHorizontal(); } }