From 04e476eb84e63ffa97b8c4855b1caa5c0b83ac50 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 19 Feb 2023 18:26:07 +0000 Subject: [PATCH] dev-cmd/contributions: Add `--repositories=brew,core,cask` shorthand - For annual "has this person contributed enough", we focus on the main Homebrew repos: brew, core and cask. Let's make that easier than `--repositories=brew,core,cask`. --- Library/Homebrew/dev-cmd/contributions.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/contributions.rb b/Library/Homebrew/dev-cmd/contributions.rb index f8c1aebc40..687719d4eb 100755 --- a/Library/Homebrew/dev-cmd/contributions.rb +++ b/Library/Homebrew/dev-cmd/contributions.rb @@ -9,8 +9,9 @@ module Homebrew module_function + PRIMARY_REPOS = %w[brew core cask].freeze SUPPORTED_REPOS = [ - %w[brew core cask], + PRIMARY_REPOS, OFFICIAL_CMD_TAPS.keys.map { |t| t.delete_prefix("homebrew/") }, OFFICIAL_CASK_TAPS.reject { |t| t == "cask" }, ].flatten.freeze @@ -28,7 +29,8 @@ module Homebrew comma_array "--repositories", description: "Specify a comma-separated (no spaces) list of repositories to search. " \ "Supported repositories: #{SUPPORTED_REPOS.map { |t| "`#{t}`" }.to_sentence}." \ - "Omitting this flag, or specifying `--repositories=all`, will search all repositories." + "Omitting this flag, or specifying `--repositories=all`, searches all repositories." \ + "Use `--repositories=primary` to search only the main repositories: brew,core,cask." flag "--from=", description: "Date (ISO-8601 format) to start searching contributions." @@ -49,7 +51,13 @@ module Homebrew results = {} all_repos = args.repositories.nil? || args.repositories.include?("all") - repos = all_repos ? SUPPORTED_REPOS : args.repositories + repos = if all_repos + SUPPORTED_REPOS + elsif args.repositories.include?("primary") + PRIMARY_REPOS + else + args.repositories + end repos.each do |repo| if SUPPORTED_REPOS.exclude?(repo)