Example #1
0
 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);
 }
Example #2
0
 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);
 }
Example #3
0
        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);
        }
Example #4
0
        static void PrintLine(GitInfo g)
        {
            var infoRender = new InfoRender();

            infoRender.PrintLineDetails(g);
        }