public async Task <string> GetHeadBranch() { var outList = new List <ProcessOutputLine>(); var result = await WopProcessRunner.RunProcessAsyncWithResults("git", "symbolic-ref refs/remotes/origin/HEAD", outList); if (result != 0) { Console.WriteLine("Couldn't determine head branch, command failed."); return(null); } var theName = outList.FirstOrDefault(t => t.Type == ProcessOutputLineType.Log && t.Txt.ToLowerInvariant().Contains("origin")); if (theName == null || string.IsNullOrWhiteSpace(theName.Txt) || theName.Txt.Count(t => t == '/') == 0) { Console.WriteLine($"Couldn't determine head branch, output isn't as expected: {theName}"); return(null); } var lio = theName.Txt.LastIndexOf('/'); var headBranchName = theName.Txt.Substring(lio + 1); return(headBranchName); }
public async Task <int> RunHubCommand(string command) { return(await WopProcessRunner.RunProcessAsync("hub", command)); }
public async Task RunHubCommand(string command) { var psi = new ProcessStartInfo("hub", command); await WopProcessRunner.RunProcessAsync(psi); }