DrillSergeant/Program.cs

34 lines
877 B
C#
Raw Normal View History

2022-07-29 17:18:24 -05:00
using LibGit2Sharp;
2022-07-29 18:51:22 -05:00
static class Program
2022-07-29 17:18:24 -05:00
{
internal static void Main(string[] args)
{
List<string> authors = new List<string>();
Dictionary<string, int> commitReport = new Dictionary<string, int>();
2022-07-29 18:51:22 -05:00
using (var repo = new Repository(Directory.GetCurrentDirectory()))
2022-07-29 17:18:24 -05:00
{
foreach (var c in repo.Commits)
{
2022-07-29 18:51:22 -05:00
if (!authors.Contains(c.Author.Name))
2022-07-29 17:18:24 -05:00
{
2022-07-29 18:51:22 -05:00
authors.Add(c.Author.Name);
2022-07-29 17:18:24 -05:00
}
}
foreach (var a in authors)
{
2022-07-29 18:51:22 -05:00
int commitCount = repo.Commits.Where(r => r.Author.Name == a).Count();
2022-07-29 17:18:24 -05:00
commitReport.Add(a, commitCount);
}
}
foreach (var r in commitReport)
{
System.Console.WriteLine($"{r.ToString()}");
}
}
}