From 9345c14cfe615271f50dfd4743470cc3901d8981 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sun, 31 Jul 2022 18:39:20 -0400 Subject: [PATCH] program --- Program.cs | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/Program.cs b/Program.cs index dba23b0..a07a0a2 100644 --- a/Program.cs +++ b/Program.cs @@ -4,30 +4,25 @@ static class Program { internal static void Main(string[] args) { - List authors = new List(); - Dictionary commitReport = new Dictionary(); - - using (var repo = new Repository(Directory.GetCurrentDirectory())) + try { - foreach (var c in repo.Commits) - { - if (!authors.Contains(c.Author.Name)) - { - authors.Add(c.Author.Name); - } - } - - foreach (var a in authors) - { - int commitCount = repo.Commits.Where(r => r.Author.Name == a).Count(); - commitReport.Add(a, commitCount); - } - + CommitDetail commits = new CommitDetail(); + commits.GetAllCommitsByName(); + // SortedList results = commits.OrderCommitsByCount(); + //StdOutDataService outDataService = new StdOutDataService(); + ExcelDataService excelDataService = new ExcelDataService(); + //DataAccess dataAccess = new DataAccess(outDataService); + DataAccess dataAccess = new DataAccess(excelDataService); + dataAccess.WriteData(commits.CommitDetails); } - - foreach (var r in commitReport) + catch (System.IO.DirectoryNotFoundException e) { - System.Console.WriteLine($"{r.ToString()}"); + Console.WriteLine($"Are you in a git repository? {e}"); + Environment.Exit(1); + } + catch (System.Exception e) + { + Console.WriteLine(e); } } }