Merge pull request #16830 from jck112/bump-tap

dev-cmd/bump: add `--tap=` flag
This commit is contained in:
Mike McQuaid 2024-03-06 15:20:12 +00:00 committed by GitHub
commit 54de70d4a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -35,6 +35,8 @@ module Homebrew
description: "Check only formulae."
switch "--cask", "--casks",
description: "Check only casks."
flag "--tap=",
description: "Check formulae and casks within the given tap, specified as <user>`/`<repo>."
switch "--installed",
description: "Check formulae and casks that are currently installed."
switch "--no-fork",
@ -49,6 +51,7 @@ module Homebrew
hidden: true
conflicts "--cask", "--formula"
conflicts "--tap=", "--installed"
conflicts "--no-pull-requests", "--open-pr"
named_args [:formula, :cask], without_api: true
@ -68,7 +71,14 @@ module Homebrew
odisabled "brew bump --force" if args.force?
Homebrew.with_no_api_env do
formulae_and_casks = if args.installed?
formulae_and_casks = if args.tap
tap = Tap.fetch(args.tap)
raise UsageError, "`--tap` cannot be used with official taps." if tap.official?
formulae = args.cask? ? [] : tap.formula_files.map { |path| Formulary.factory(path) }
casks = args.formula? ? [] : tap.cask_files.map { |path| Cask::CaskLoader.load(path) }
formulae + casks
elsif args.installed?
formulae = args.cask? ? [] : Formula.installed
casks = args.formula? ? [] : Cask::Caskroom.casks
formulae + casks

View File

@ -20,4 +20,11 @@ RSpec.describe "brew bump" do
.and be_a_success
end
end
it "gives an error for `--tap` with official taps", :integration_test do
expect { brew "bump", "--tap", "Homebrew/core" }
.to output(/Invalid usage/).to_stderr
.and not_to_output.to_stdout
.and be_a_failure
end
end