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`.
This commit is contained in:
parent
a222a5bbc8
commit
04e476eb84
@ -9,8 +9,9 @@ module Homebrew
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
PRIMARY_REPOS = %w[brew core cask].freeze
|
||||||
SUPPORTED_REPOS = [
|
SUPPORTED_REPOS = [
|
||||||
%w[brew core cask],
|
PRIMARY_REPOS,
|
||||||
OFFICIAL_CMD_TAPS.keys.map { |t| t.delete_prefix("homebrew/") },
|
OFFICIAL_CMD_TAPS.keys.map { |t| t.delete_prefix("homebrew/") },
|
||||||
OFFICIAL_CASK_TAPS.reject { |t| t == "cask" },
|
OFFICIAL_CASK_TAPS.reject { |t| t == "cask" },
|
||||||
].flatten.freeze
|
].flatten.freeze
|
||||||
@ -28,7 +29,8 @@ module Homebrew
|
|||||||
comma_array "--repositories",
|
comma_array "--repositories",
|
||||||
description: "Specify a comma-separated (no spaces) list of repositories to search. " \
|
description: "Specify a comma-separated (no spaces) list of repositories to search. " \
|
||||||
"Supported repositories: #{SUPPORTED_REPOS.map { |t| "`#{t}`" }.to_sentence}." \
|
"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=",
|
flag "--from=",
|
||||||
description: "Date (ISO-8601 format) to start searching contributions."
|
description: "Date (ISO-8601 format) to start searching contributions."
|
||||||
|
|
||||||
@ -49,7 +51,13 @@ module Homebrew
|
|||||||
results = {}
|
results = {}
|
||||||
|
|
||||||
all_repos = args.repositories.nil? || args.repositories.include?("all")
|
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|
|
repos.each do |repo|
|
||||||
if SUPPORTED_REPOS.exclude?(repo)
|
if SUPPORTED_REPOS.exclude?(repo)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user