From 9aad9d011be583c39620f4fd3de1bcf8ff34f30f Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 15 Feb 2023 13:56:37 +0000 Subject: [PATCH] dev-cmd/contributions: Add a per-repo total column to the CSV ``` $ brew contributions issyl0 --csv The user issyl0 has made 1202 contributions in all time. user,repo,commits,coauthorships,signoffs,total issyl0,brew,332,13,0,345 issyl0,core,473,24,326,823 issyl0,cask,4,0,0,4 issyl0,aliases,0,0,0,0 issyl0,autoupdate,1,0,0,1 issyl0,bundle,14,2,0,16 issyl0,command-not-found,1,0,0,1 issyl0,test-bot,3,0,0,3 issyl0,services,9,0,0,9 issyl0,cask-drivers,0,0,0,0 issyl0,cask-fonts,0,0,0,0 issyl0,cask-versions,0,0,0,0 ``` --- Library/Homebrew/dev-cmd/contributions.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/contributions.rb b/Library/Homebrew/dev-cmd/contributions.rb index ed1cdf44e2..84c1acd7f5 100755 --- a/Library/Homebrew/dev-cmd/contributions.rb +++ b/Library/Homebrew/dev-cmd/contributions.rb @@ -96,9 +96,16 @@ module Homebrew sig { params(user: String, results: Hash).returns(String) } def generate_csv(user, results) CSV.generate do |csv| - csv << %w[user repo commits coauthorships signoffs] + csv << %w[user repo commits coauthorships signoffs total] results.each do |repo, counts| - csv << [user, repo, counts[:commits], counts[:coauthorships], counts[:signoffs]] + csv << [ + user, + repo, + counts[:commits], + counts[:coauthorships], + counts[:signoffs], + counts.values.sum + ] end end end