dev-cmd/contributions: Revert to --repositories flag
- This doesn't require "all" to be specified as part of the command, it's the default, so usage is now just: ``` $ brew contributions "Issy Long" $ brew contributions "Issy Long" --repositories=brew,core $ brew contributions me@issyl0.co.uk --repositories=cask,bundle ``` - As we discussed in the PR review before, `comma_array` doesn't allow two names, so we can't (yet) do `comma_array "--repositories", "--repos"` like we can with `flag`. That's an enhancement for the future if we want to make the flags here less verbose. But now that "all" is the default, maybe less necessary.
This commit is contained in:
parent
31331663e4
commit
0bb8a06193
@ -17,24 +17,24 @@ 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|name> <repo1,repo2|all>"
|
usage_banner "`contributions` <email|name>"
|
||||||
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 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.
|
|
||||||
Specify <all> to search all repositories.
|
|
||||||
Supported repositories: #{SUPPORTED_REPOS.join(", ")}.
|
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
|
comma_array "--repositories",
|
||||||
|
description: "Specify a comma-separated (no spaces) list of repositories to search. " \
|
||||||
|
"Supported repositories: #{SUPPORTED_REPOS.join(", ")}. " \
|
||||||
|
"Omitting this flag, or specifying `--repositories=all`, will search all repositories."
|
||||||
flag "--from=",
|
flag "--from=",
|
||||||
description: "Date (ISO-8601 format) to start searching contributions."
|
description: "Date (ISO-8601 format) to start searching contributions."
|
||||||
|
|
||||||
flag "--to=",
|
flag "--to=",
|
||||||
description: "Date (ISO-8601 format) to stop searching contributions."
|
description: "Date (ISO-8601 format) to stop searching contributions."
|
||||||
|
|
||||||
named_args min: 2, max: 2
|
named_args min: 1, max: 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -45,8 +45,8 @@ module Homebrew
|
|||||||
commits = 0
|
commits = 0
|
||||||
coauthorships = 0
|
coauthorships = 0
|
||||||
|
|
||||||
all_repos = args.named.last == "all"
|
all_repos = args.repositories.nil? || args.repositories.include?("all")
|
||||||
repos = all_repos ? SUPPORTED_REPOS : args.named.last.split(",")
|
repos = all_repos ? SUPPORTED_REPOS : args.repositories
|
||||||
|
|
||||||
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