public void PrintLineDetails(GitInfo l) { _writer.W("Repo : ", HeaderColor).WL(l.TopLevel, RepoColor) .W("Branch : ", HeaderColor).WL(l.Branch, BranchColor) .W("Hash : ", HeaderColor).WL(l.FullHash, HashColor) .W("Remote : ", HeaderColor).WL(l.Remote, RemoteColor); }
public void PrintLineRow(GitInfo l) { _writer.W($"{l.TopLevel.PadRight(RepoPad)}", RepoColor) .W($"{l.Branch.PadRight(BranchPad)}", BranchColor) .W($"{l.Hash.PadRight(10)}", HashColor) .W($"{l.Remote}\n", RemoteColor); }
public GitInfo ProcessPath(string path) { var oldDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(path); var simpleExec = new SimpleExec(); var branch = simpleExec.Exec("git", "rev-parse --abbrev-ref HEAD").Trim(); var remote = simpleExec.Exec("git", "config --get remote.origin.url").Trim(); var topLevel = simpleExec.Exec("git", "rev-parse --show-toplevel").Trim(); var fullhash = simpleExec.Exec("git", "log --pretty=format:%H -n 1").Trim(); var hash = simpleExec.Exec("git", "rev-parse --short HEAD").Trim(); var o = new GitInfo { Branch = branch, Remote = ParseRemote(remote, fullhash), TopLevel = Path.GetFileName(topLevel), Hash = hash, FullHash = fullhash }; Directory.SetCurrentDirectory(oldDir); return(o); }
static void PrintLine(GitInfo g) { var infoRender = new InfoRender(); infoRender.PrintLineDetails(g); }