Merge pull request #16830 from jck112/bump-tap
dev-cmd/bump: add `--tap=` flag
This commit is contained in:
commit
54de70d4a6
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user