dev-cmd/contributions: Make the first arg either a name or email

- This is easier than mapping GitHub usernames to email addresses, when
  folks don't have email addresses always public on their GitHub
  profiles. Also, the users of this command (PLC members, other
  interested parties) don't have to remember folks' email addresses.
- It also gives better data for people who've changed their name over
  the years, and who commit with multiple email addresses (personal and
  work).

```
❯ brew contributions "Issy Long" all
Person Issy Long directly authored 687 commits and co-authored 33 commits across all Homebrew repos in all time.

❯ brew contributions "Rylan Polster" all
Person Rylan Polster directly authored 1747 commits and co-authored 133 commits across all Homebrew repos in all time.

❯ brew contributions me@issyl0.co.uk all
Person me@issyl0.co.uk directly authored 711 commits and co-authored 25 commits across all Homebrew repos in all time.

❯ brew contributions "Mike McQuaid" all
Person Mike McQuaid directly authored 26879 commits and co-authored 204 commits across all Homebrew repos in all time.
```
This commit is contained in:
Issy Long 2022-08-01 17:38:56 +01:00
parent ae73f28d0f
commit 0c7825accd
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -17,10 +17,12 @@ module Homebrew
sig { returns(CLI::Parser) } sig { returns(CLI::Parser) }
def contributions_args def contributions_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner "`contributions` <email> <repo1,repo2|all>" usage_banner "`contributions` <email|name> <repo1,repo2|all>"
description <<~EOS description <<~EOS
Contributions to Homebrew repos for a user. Contributions to Homebrew repos for a user.
The first argument is a name (e.g. "BrewTestBot") or an email address (e.g. "brewtestbot@brew.sh").
The second argument is a comma-separated list of repos to search. The second argument is a comma-separated list of repos to search.
Specify <all> to search all repositories. Specify <all> to search all repositories.
Supported repositories: #{SUPPORTED_REPOS.join(", ")}. Supported repositories: #{SUPPORTED_REPOS.join(", ")}.
@ -32,7 +34,7 @@ module Homebrew
flag "--to=", flag "--to=",
description: "Date (ISO-8601 format) to stop searching contributions." description: "Date (ISO-8601 format) to stop searching contributions."
named_args [:email, :repositories], min: 2, max: 2 named_args [:email, :name, :repositories], min: 2, max: 2
end end
end end