From 6bc6aae0ca7642bfda96459e4e5ee934921f1d80 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Wed, 24 Jan 2024 12:23:18 -0500 Subject: [PATCH] cmd/upgrade: rename arg to installed_formula/cask This avoids running `brew outdated` in shell completions, which is noticeably slow. --- Library/Homebrew/cmd/upgrade.rb | 2 +- Library/Homebrew/test/completions_spec.rb | 6 +++--- completions/bash/brew | 4 ++-- completions/fish/brew.fish | 4 ++-- completions/zsh/_brew | 8 ++++---- docs/Manpage.md | 2 +- manpages/brew.1 | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 0e437384e0..ed712f3070 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -119,7 +119,7 @@ module Homebrew conflicts "--build-from-source", "--force-bottle" - named_args [:outdated_formula, :outdated_cask] + named_args [:installed_formula, :installed_cask] end end diff --git a/Library/Homebrew/test/completions_spec.rb b/Library/Homebrew/test/completions_spec.rb index da5b08d8d1..9d166d95a4 100644 --- a/Library/Homebrew/test/completions_spec.rb +++ b/Library/Homebrew/test/completions_spec.rb @@ -294,7 +294,7 @@ describe Homebrew::Completions do it "returns appropriate completion for a command with multiple named arg types" do completion = described_class.generate_bash_subcommand_completion("upgrade") - expect(completion).to match(/__brew_complete_outdated_formulae\n __brew_complete_outdated_casks\n}$/) + expect(completion).to match(/__brew_complete_installed_formulae\n __brew_complete_installed_casks\n}$/) end end @@ -415,10 +415,10 @@ describe Homebrew::Completions do completion = described_class.generate_fish_subcommand_completion("upgrade") expected_line_start = "__fish_brew_complete_arg 'upgrade; and not __fish_seen_argument" expect(completion).to match( - /#{expected_line_start} -l cask -l casks' -a '\(__fish_brew_suggest_formulae_outdated\)'/, + /#{expected_line_start} -l cask -l casks' -a '\(__fish_brew_suggest_formulae_installed\)'/, ) expect(completion).to match( - /#{expected_line_start} -l formula -l formulae' -a '\(__fish_brew_suggest_casks_outdated\)'/, + /#{expected_line_start} -l formula -l formulae' -a '\(__fish_brew_suggest_casks_installed\)'/, ) end end diff --git a/completions/bash/brew b/completions/bash/brew index ab3c10eb11..8bc69fa51d 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -2588,8 +2588,8 @@ _brew_upgrade() { ;; *) ;; esac - __brew_complete_outdated_formulae - __brew_complete_outdated_casks + __brew_complete_installed_formulae + __brew_complete_installed_casks } _brew_uses() { diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 559f99abe0..6c8d26d761 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -1690,8 +1690,8 @@ __fish_brew_complete_arg 'upgrade' -l skip-cask-deps -d 'Skip installing cask de __fish_brew_complete_arg 'upgrade' -l verbose -d 'Print the verification and post-install steps' __fish_brew_complete_arg 'upgrade' -l vst-plugindir -d 'Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)' __fish_brew_complete_arg 'upgrade' -l vst3-plugindir -d 'Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)' -__fish_brew_complete_arg 'upgrade; and not __fish_seen_argument -l cask -l casks' -a '(__fish_brew_suggest_formulae_outdated)' -__fish_brew_complete_arg 'upgrade; and not __fish_seen_argument -l formula -l formulae' -a '(__fish_brew_suggest_casks_outdated)' +__fish_brew_complete_arg 'upgrade; and not __fish_seen_argument -l cask -l casks' -a '(__fish_brew_suggest_formulae_installed)' +__fish_brew_complete_arg 'upgrade; and not __fish_seen_argument -l formula -l formulae' -a '(__fish_brew_suggest_casks_installed)' __fish_brew_complete_cmd 'uses' 'Show formulae and casks that specify formula as a dependency; that is, show dependents of formula' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 42d396abdc..3c0198f098 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -2078,12 +2078,12 @@ _brew_upgrade() { '--verbose[Print the verification and post-install steps]' \ '(--formula)--vst-plugindir[Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)]' \ '(--formula)--vst3-plugindir[Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)]' \ - - outdated_formula \ + - installed_formula \ '(--casks --skip-cask-deps --greedy --greedy-latest --greedy-auto-updates --binaries --require-sha --quarantine --appdir --keyboard-layoutdir --colorpickerdir --prefpanedir --qlplugindir --mdimporterdir --dictionarydir --fontdir --servicedir --input-methoddir --internet-plugindir --audio-unit-plugindir --vst-plugindir --vst3-plugindir --screen-saverdir --language)--formula[Treat all named arguments as formulae. If no named arguments are specified, upgrade only outdated formulae]' \ - '*::outdated_formula:__brew_outdated_formulae' \ - - outdated_cask \ + '*::installed_formula:__brew_installed_formulae' \ + - installed_cask \ '(--formulae --build-from-source --interactive --force-bottle --fetch-HEAD --ignore-pinned --keep-tmp --debug-symbols --display-times)--cask[Treat all named arguments as casks. If no named arguments are specified, upgrade only outdated casks]' \ - '*::outdated_cask:__brew_outdated_casks' + '*::installed_cask:__brew_installed_casks' } # brew uses diff --git a/docs/Manpage.md b/docs/Manpage.md index d4c040ca9a..24a7a6d738 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -770,7 +770,7 @@ Fetch and reset Homebrew and all tap repositories (or any specified *`repository *Note:* this will destroy all your uncommitted or committed changes. -### `upgrade` [*`options`*] [*`outdated_formula`*|*`outdated_cask`* ...] +### `upgrade` [*`options`*] [*`installed_formula`*|*`installed_cask`* ...] Upgrade outdated casks and outdated, unpinned formulae using the same options they were originally installed with, plus any appended brew formula options. If *`cask`* or *`formula`* are specified, diff --git a/manpages/brew.1 b/manpages/brew.1 index 112bb2e72e..954d4c9fdf 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1060,7 +1060,7 @@ Fetch and reset Homebrew and all tap repositories (or any specified \fIrepositor .P \fINote:\fR this will destroy all your uncommitted or committed changes\. . -.SS "\fBupgrade\fR [\fIoptions\fR] [\fIoutdated_formula\fR|\fIoutdated_cask\fR \.\.\.]" +.SS "\fBupgrade\fR [\fIoptions\fR] [\fIinstalled_formula\fR|\fIinstalled_cask\fR \.\.\.]" Upgrade outdated casks and outdated, unpinned formulae using the same options they were originally installed with, plus any appended brew formula options\. If \fIcask\fR or \fIformula\fR are specified, upgrade only the given \fIcask\fR or \fIformula\fR kegs (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\. . .P