diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index da8140a4f0baf..84b01affc4770 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -35,6 +35,8 @@ def bump_args description: "Check only formulae." switch "--cask", "--casks", description: "Check only casks." + switch "--installed", + description: "Check formulae and casks that are currently installed." switch "--open-pr", description: "Open a pull request for the new version if none have been opened yet." flag "--limit=", @@ -60,26 +62,33 @@ def bump raise UsageError, "`--limit` must be used with either `--formula` or `--cask`." end - formulae_and_casks = if args.formula? - args.named.to_formulae - elsif args.cask? - args.named.to_casks - else - args.named.to_formulae_and_casks - end - formulae_and_casks = formulae_and_casks&.sort_by do |formula_or_cask| - formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name - end + Homebrew.with_no_api_env do + formulae_and_casks = if args.installed? + formulae = args.cask? ? [] : Formula.installed + casks = args.formula? ? [] : Cask::Caskroom.casks + formulae + casks + elsif args.named.present? + if args.formula? + args.named.to_formulae + elsif args.cask? + args.named.to_casks + else + args.named.to_formulae_and_casks + end + end - unless Utils::Curl.curl_supports_tls13? - begin - ensure_formula_installed!("curl", reason: "Repology queries") unless HOMEBREW_BREWED_CURL_PATH.exist? - rescue FormulaUnavailableError - opoo "A newer `curl` is required for Repology queries." + formulae_and_casks = formulae_and_casks&.sort_by do |formula_or_cask| + formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name + end + + unless Utils::Curl.curl_supports_tls13? + begin + ensure_formula_installed!("curl", reason: "Repology queries") unless HOMEBREW_BREWED_CURL_PATH.exist? + rescue FormulaUnavailableError + opoo "A newer `curl` is required for Repology queries." + end end - end - Homebrew.with_no_api_env do if formulae_and_casks.present? handle_formula_and_casks(formulae_and_casks, args) else diff --git a/completions/bash/brew b/completions/bash/brew index 399e844e737e4..2c523322057c2 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -441,6 +441,7 @@ _brew_bump() { --formula --full-name --help + --installed --limit --no-pull-requests --open-pr diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index ea011bf9a86e0..3c0507b3e6b0f 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -384,6 +384,7 @@ __fish_brew_complete_arg 'bump' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'bump' -l formula -d 'Check only formulae' __fish_brew_complete_arg 'bump' -l full-name -d 'Print formulae/casks with fully-qualified names' __fish_brew_complete_arg 'bump' -l help -d 'Show this message' +__fish_brew_complete_arg 'bump' -l installed -d 'Check formulae and casks that are currently installed' __fish_brew_complete_arg 'bump' -l limit -d 'Limit number of package results returned' __fish_brew_complete_arg 'bump' -l no-pull-requests -d 'Do not retrieve pull requests from GitHub' __fish_brew_complete_arg 'bump' -l open-pr -d 'Open a pull request for the new version if none have been opened yet' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 8fc52f55ac3f7..a8164b8dc29b1 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -495,6 +495,7 @@ _brew_bump() { '--debug[Display any debugging information]' \ '--full-name[Print formulae/casks with fully-qualified names]' \ '--help[Show this message]' \ + '--installed[Check formulae and casks that are currently installed]' \ '--limit[Limit number of package results returned]' \ '(--open-pr)--no-pull-requests[Do not retrieve pull requests from GitHub]' \ '(--no-pull-requests)--open-pr[Open a pull request for the new version if none have been opened yet]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index d4059e01e2c18..4ee78ea4ec819 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1012,6 +1012,8 @@ formulae, also displays whether a pull request has been opened with the URL. Check only formulae. * `--cask`: Check only casks. +* `--installed`: + Check formulae and casks that are currently installed. * `--open-pr`: Open a pull request for the new version if none have been opened yet. * `--limit`: diff --git a/manpages/brew.1 b/manpages/brew.1 index fb25c6f94c874..add813434a958 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1443,6 +1443,10 @@ Check only formulae\. Check only casks\. . .TP +\fB\-\-installed\fR +Check formulae and casks that are currently installed\. +. +.TP \fB\-\-open\-pr\fR Open a pull request for the new version if none have been opened yet\. .