Add missing cask options to brew upgrade.

This commit is contained in:
Markus Reiter 2020-09-28 02:34:14 +02:00
parent 994e95e356
commit 7f14e55f99
4 changed files with 342 additions and 74 deletions

View File

@ -13,16 +13,25 @@ module Cask
"Upgrades all outdated casks or the specified casks." "Upgrades all outdated casks or the specified casks."
end end
OPTIONS = [
[:switch, "--skip-cask-deps", {
description: "Skip installing cask dependencies.",
}],
[:switch, "--greedy", {
description: "Also include casks with `auto_updates true` or `version :latest`.",
}],
].freeze
def self.parser def self.parser
super do super do
switch "--force", switch "--force",
description: "Force overwriting existing files." description: "Force overwriting existing files."
switch "--skip-cask-deps",
description: "Skip installing cask dependencies."
switch "--greedy",
description: "Also include casks which specify `auto_updates true` or `version :latest`."
switch "--dry-run", switch "--dry-run",
description: "Show what would be upgraded, but do not actually upgrade anything." description: "Show what would be upgraded, but do not actually upgrade anything."
OPTIONS.each do |option|
send(*option)
end
end end
end end

View File

@ -12,6 +12,51 @@ module Homebrew
module_function module_function
def upgrade_args def upgrade_args
cask_only_options = [
[:switch, "--cask", "--casks", {
description: "Treat all named arguments as casks. If no named arguments " \
"are specified, upgrade only outdated casks.",
}],
*Cask::Cmd::OPTIONS,
*Cask::Cmd::AbstractCommand::OPTIONS,
*Cask::Cmd::Upgrade::OPTIONS,
]
formula_only_options = [
[:switch, "--formula", "--formulae", {
description: "Treat all named arguments as formulae. If no named arguments" \
"are specified, upgrade only outdated formulae.",
}],
[:switch, "-s", "--build-from-source", {
description: "Compile <formula> from source even if a bottle is available.",
}],
[:switch, "-i", "--interactive", {
description: "Download and patch <formula>, then open a shell. This allows the user to "\
"run `./configure --help` and otherwise determine how to turn the software "\
"package into a Homebrew package.",
}],
[:switch, "--force-bottle", {
description: "Install from a bottle if it exists for the current or newest version of "\
"macOS, even if it would not normally be used for installation.",
}],
[:switch, "--fetch-HEAD", {
description: "Fetch the upstream repository to detect if the HEAD installation of the "\
"formula is outdated. Otherwise, the repository's HEAD will only be checked for "\
"updates when a new stable or development version has been released.",
}],
[:switch, "--ignore-pinned", {
description: "Set a successful exit status even if pinned formulae are not upgraded.",
}],
[:switch, "--keep-tmp", {
description: "Retain the temporary files created during installation.",
}],
[:switch, "--display-times", {
env: :display_install_times,
description: "Print install times for each formula at the end of the run.",
}],
]
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`upgrade` [<options>] [<formula>|<cask>] `upgrade` [<options>] [<formula>|<cask>]
@ -26,46 +71,26 @@ module Homebrew
switch "-d", "--debug", switch "-d", "--debug",
description: "If brewing fails, open an interactive debugging session with access to IRB "\ description: "If brewing fails, open an interactive debugging session with access to IRB "\
"or a shell inside the temporary build directory." "or a shell inside the temporary build directory."
switch "--formula",
description: "Only upgrade outdated formulae."
switch "--cask",
description: "Only upgrade outdated casks."
switch "-s", "--build-from-source",
description: "Compile <formula> from source even if a bottle is available."
switch "-i", "--interactive",
description: "Download and patch <formula>, then open a shell. This allows the user to "\
"run `./configure --help` and otherwise determine how to turn the software "\
"package into a Homebrew package."
switch "--force-bottle",
description: "Install from a bottle if it exists for the current or newest version of "\
"macOS, even if it would not normally be used for installation."
switch "--fetch-HEAD",
description: "Fetch the upstream repository to detect if the HEAD installation of the "\
"formula is outdated. Otherwise, the repository's HEAD will only be checked for "\
"updates when a new stable or development version has been released."
switch "--ignore-pinned",
description: "Set a successful exit status even if pinned formulae are not upgraded."
switch "--keep-tmp",
description: "Retain the temporary files created during installation."
switch "-f", "--force", switch "-f", "--force",
description: "Install without checking for previously installed keg-only or "\ description: "Install formulae without checking for previously installed keg-only or "\
"non-migrated versions." "non-migrated versions. Overwrite existing files when installing casks."
switch "-v", "--verbose", switch "-v", "--verbose",
description: "Print the verification and postinstall steps." description: "Print the verification and postinstall steps."
switch "--display-times",
env: :display_install_times,
description: "Print install times for each formula at the end of the run."
switch "-n", "--dry-run", switch "-n", "--dry-run",
description: "Show what would be upgraded, but do not actually upgrade anything." description: "Show what would be upgraded, but do not actually upgrade anything."
switch "--greedy",
description: "Upgrade casks with `auto_updates` or `version :latest`"
conflicts "--build-from-source", "--force-bottle" conflicts "--build-from-source", "--force-bottle"
conflicts "--formula", "--greedy"
["--formula", "-s", "--build-from-source", "-i", "--interactive", formula_only_options.each do |options|
"--force-bottle", "--fetch-HEAD", "--ignore-pinned", "--keep-tmp", send(*options)
"--display-times"].each do |flag| conflicts "--cask", options[-2]
conflicts "--cask", flag
end end
cask_only_options.each do |options|
send(*options)
conflicts "--formula", options[-2]
end
formula_options formula_options
end end
end end

View File

@ -534,6 +534,12 @@ reinstalled formulae or, every 30 days, for all formulae.
* `-d`, `--debug`: * `-d`, `--debug`:
If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory. If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory.
* `-f`, `--force`:
Install without checking for previously installed keg-only or non-migrated versions.
* `-v`, `--verbose`:
Print the verification and postinstall steps.
* `--formula`:
Treat all named arguments as formulae.
* `-s`, `--build-from-source`: * `-s`, `--build-from-source`:
Compile *`formula`* from source even if a bottle is available. Compile *`formula`* from source even if a bottle is available.
* `-i`, `--interactive`: * `-i`, `--interactive`:
@ -542,12 +548,46 @@ reinstalled formulae or, every 30 days, for all formulae.
Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation. Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation.
* `--keep-tmp`: * `--keep-tmp`:
Retain the temporary files created during installation. Retain the temporary files created during installation.
* `-f`, `--force`:
Install without checking for previously installed keg-only or non-migrated versions.
* `-v`, `--verbose`:
Print the verification and postinstall steps.
* `--display-times`: * `--display-times`:
Print install times for each formula at the end of the run. Print install times for each formula at the end of the run.
* `--cask`:
Treat all named arguments as casks.
* `--appdir`:
Target location for Applications. Default: `/Applications`
* `--colorpickerdir`:
Target location for Color Pickers. Default: `~/Library/ColorPickers`
* `--prefpanedir`:
Target location for Preference Panes. Default: `~/Library/PreferencePanes`
* `--qlplugindir`:
Target location for QuickLook Plugins. Default: `~/Library/QuickLook`
* `--mdimporterdir`:
Target location for Spotlight Plugins. Default: `~/Library/Spotlight`
* `--dictionarydir`:
Target location for Dictionaries. Default: `~/Library/Dictionaries`
* `--fontdir`:
Target location for Fonts. Default: `~/Library/Fonts`
* `--servicedir`:
Target location for Services. Default: `~/Library/Services`
* `--input_methoddir`:
Target location for Input Methods. Default: `~/Library/Input Methods`
* `--internet_plugindir`:
Target location for Internet Plugins. Default: `~/Library/Internet Plug-Ins`
* `--audio_unit_plugindir`:
Target location for Audio Unit Plugins. Default: `~/Library/Audio/Plug-Ins/Components`
* `--vst_plugindir`:
Target location for VST Plugins. Default: `~/Library/Audio/Plug-Ins/VST`
* `--vst3_plugindir`:
Target location for VST3 Plugins. Default: `~/Library/Audio/Plug-Ins/VST3`
* `--screen_saverdir`:
Target location for Screen Savers. Default: `~/Library/Screen Savers`
* `--language`:
Set language of the Cask to install. The first matching language is used, otherwise the default language on the Cask. The default value is the `language of your system`
* `--[no-]binaries`:
Disable/enable linking of helper executables. Default: enabled
* `--require-sha`:
Require all casks to have a checksum.
* `--[no-]quarantine`:
Disable/enable quarantining of downloads. Default: enabled
### `search` [*`options`*] [*`text`*|`/`*`text`*`/`] ### `search` [*`options`*] [*`text`*|`/`*`text`*`/`]
@ -681,10 +721,14 @@ upgraded formulae or, every 30 days, for all formulae.
* `-d`, `--debug`: * `-d`, `--debug`:
If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory. If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory.
* `-f`, `--force`:
Install formulae without checking for previously installed keg-only or non-migrated versions. Overwrite existing files when installing casks.
* `-v`, `--verbose`:
Print the verification and postinstall steps.
* `-n`, `--dry-run`:
Show what would be upgraded, but do not actually upgrade anything.
* `--formula`: * `--formula`:
Only upgrade outdated formulae. Treat all named arguments as formulae. If no named argumentsare specified, upgrade only outdated formulae.
* `--cask`:
Only upgrade outdated casks.
* `-s`, `--build-from-source`: * `-s`, `--build-from-source`:
Compile *`formula`* from source even if a bottle is available. Compile *`formula`* from source even if a bottle is available.
* `-i`, `--interactive`: * `-i`, `--interactive`:
@ -697,16 +741,50 @@ upgraded formulae or, every 30 days, for all formulae.
Set a successful exit status even if pinned formulae are not upgraded. Set a successful exit status even if pinned formulae are not upgraded.
* `--keep-tmp`: * `--keep-tmp`:
Retain the temporary files created during installation. Retain the temporary files created during installation.
* `-f`, `--force`:
Install without checking for previously installed keg-only or non-migrated versions.
* `-v`, `--verbose`:
Print the verification and postinstall steps.
* `--display-times`: * `--display-times`:
Print install times for each formula at the end of the run. Print install times for each formula at the end of the run.
* `-n`, `--dry-run`: * `--cask`:
Show what would be upgraded, but do not actually upgrade anything. Treat all named arguments as casks. If no named arguments are specified, upgrade only outdated casks.
* `--appdir`:
Target location for Applications. Default: `/Applications`
* `--colorpickerdir`:
Target location for Color Pickers. Default: `~/Library/ColorPickers`
* `--prefpanedir`:
Target location for Preference Panes. Default: `~/Library/PreferencePanes`
* `--qlplugindir`:
Target location for QuickLook Plugins. Default: `~/Library/QuickLook`
* `--mdimporterdir`:
Target location for Spotlight Plugins. Default: `~/Library/Spotlight`
* `--dictionarydir`:
Target location for Dictionaries. Default: `~/Library/Dictionaries`
* `--fontdir`:
Target location for Fonts. Default: `~/Library/Fonts`
* `--servicedir`:
Target location for Services. Default: `~/Library/Services`
* `--input_methoddir`:
Target location for Input Methods. Default: `~/Library/Input Methods`
* `--internet_plugindir`:
Target location for Internet Plugins. Default: `~/Library/Internet Plug-Ins`
* `--audio_unit_plugindir`:
Target location for Audio Unit Plugins. Default: `~/Library/Audio/Plug-Ins/Components`
* `--vst_plugindir`:
Target location for VST Plugins. Default: `~/Library/Audio/Plug-Ins/VST`
* `--vst3_plugindir`:
Target location for VST3 Plugins. Default: `~/Library/Audio/Plug-Ins/VST3`
* `--screen_saverdir`:
Target location for Screen Savers. Default: `~/Library/Screen Savers`
* `--language`:
Set language of the Cask to install. The first matching language is used, otherwise the default language on the Cask. The default value is the `language of your system`
* `--[no-]binaries`:
Disable/enable linking of helper executables. Default: enabled
* `--require-sha`:
Require all casks to have a checksum.
* `--[no-]quarantine`:
Disable/enable quarantining of downloads. Default: enabled
* `--skip-cask-deps`:
Skip installing cask dependencies.
* `--greedy`: * `--greedy`:
Upgrade casks with `auto_updates` or `version :latest` Also include casks with `auto_updates true` or `version :latest`.
### `uses` [*`options`*] *`formula`* ### `uses` [*`options`*] *`formula`*

View File

@ -790,6 +790,18 @@ Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will then be
If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\. If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\.
. .
.TP .TP
\fB\-f\fR, \fB\-\-force\fR
Install without checking for previously installed keg\-only or non\-migrated versions\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Print the verification and postinstall steps\.
.
.TP
\fB\-\-formula\fR
Treat all named arguments as formulae\.
.
.TP
\fB\-s\fR, \fB\-\-build\-from\-source\fR \fB\-s\fR, \fB\-\-build\-from\-source\fR
Compile \fIformula\fR from source even if a bottle is available\. Compile \fIformula\fR from source even if a bottle is available\.
. .
@ -806,17 +818,85 @@ Install from a bottle if it exists for the current or newest version of macOS, e
Retain the temporary files created during installation\. Retain the temporary files created during installation\.
. .
.TP .TP
\fB\-f\fR, \fB\-\-force\fR
Install without checking for previously installed keg\-only or non\-migrated versions\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Print the verification and postinstall steps\.
.
.TP
\fB\-\-display\-times\fR \fB\-\-display\-times\fR
Print install times for each formula at the end of the run\. Print install times for each formula at the end of the run\.
. .
.TP
\fB\-\-cask\fR
Treat all named arguments as casks\.
.
.TP
\fB\-\-appdir\fR
Target location for Applications\. Default: \fB/Applications\fR
.
.TP
\fB\-\-colorpickerdir\fR
Target location for Color Pickers\. Default: \fB~/Library/ColorPickers\fR
.
.TP
\fB\-\-prefpanedir\fR
Target location for Preference Panes\. Default: \fB~/Library/PreferencePanes\fR
.
.TP
\fB\-\-qlplugindir\fR
Target location for QuickLook Plugins\. Default: \fB~/Library/QuickLook\fR
.
.TP
\fB\-\-mdimporterdir\fR
Target location for Spotlight Plugins\. Default: \fB~/Library/Spotlight\fR
.
.TP
\fB\-\-dictionarydir\fR
Target location for Dictionaries\. Default: \fB~/Library/Dictionaries\fR
.
.TP
\fB\-\-fontdir\fR
Target location for Fonts\. Default: \fB~/Library/Fonts\fR
.
.TP
\fB\-\-servicedir\fR
Target location for Services\. Default: \fB~/Library/Services\fR
.
.TP
\fB\-\-input_methoddir\fR
Target location for Input Methods\. Default: \fB~/Library/Input Methods\fR
.
.TP
\fB\-\-internet_plugindir\fR
Target location for Internet Plugins\. Default: \fB~/Library/Internet Plug\-Ins\fR
.
.TP
\fB\-\-audio_unit_plugindir\fR
Target location for Audio Unit Plugins\. Default: \fB~/Library/Audio/Plug\-Ins/Components\fR
.
.TP
\fB\-\-vst_plugindir\fR
Target location for VST Plugins\. Default: \fB~/Library/Audio/Plug\-Ins/VST\fR
.
.TP
\fB\-\-vst3_plugindir\fR
Target location for VST3 Plugins\. Default: \fB~/Library/Audio/Plug\-Ins/VST3\fR
.
.TP
\fB\-\-screen_saverdir\fR
Target location for Screen Savers\. Default: \fB~/Library/Screen Savers\fR
.
.TP
\fB\-\-language\fR
Set language of the Cask to install\. The first matching language is used, otherwise the default language on the Cask\. The default value is the \fBlanguage of your system\fR
.
.TP
\fB\-\-[no\-]binaries\fR
Disable/enable linking of helper executables\. Default: enabled
.
.TP
\fB\-\-require\-sha\fR
Require all casks to have a checksum\.
.
.TP
\fB\-\-[no\-]quarantine\fR
Disable/enable quarantining of downloads\. Default: enabled
.
.SS "\fBsearch\fR [\fIoptions\fR] [\fItext\fR|\fB/\fR\fItext\fR\fB/\fR]" .SS "\fBsearch\fR [\fIoptions\fR] [\fItext\fR|\fB/\fR\fItext\fR\fB/\fR]"
Perform a substring search of cask tokens and formula names for \fItext\fR\. If \fItext\fR is flanked by slashes, it is interpreted as a regular expression\. The search for \fItext\fR is extended online to \fBhomebrew/core\fR and \fBhomebrew/cask\fR\. Perform a substring search of cask tokens and formula names for \fItext\fR\. If \fItext\fR is flanked by slashes, it is interpreted as a regular expression\. The search for \fItext\fR is extended online to \fBhomebrew/core\fR and \fBhomebrew/cask\fR\.
. .
@ -970,12 +1050,20 @@ Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will then be
If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\. If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\.
. .
.TP .TP
\fB\-\-formula\fR \fB\-f\fR, \fB\-\-force\fR
Only upgrade outdated formulae\. Install formulae without checking for previously installed keg\-only or non\-migrated versions\. Overwrite existing files when installing casks\.
. .
.TP .TP
\fB\-\-cask\fR \fB\-v\fR, \fB\-\-verbose\fR
Only upgrade outdated casks\. Print the verification and postinstall steps\.
.
.TP
\fB\-n\fR, \fB\-\-dry\-run\fR
Show what would be upgraded, but do not actually upgrade anything\.
.
.TP
\fB\-\-formula\fR
Treat all named arguments as formulae\. If no named argumentsare specified, upgrade only outdated formulae\.
. .
.TP .TP
\fB\-s\fR, \fB\-\-build\-from\-source\fR \fB\-s\fR, \fB\-\-build\-from\-source\fR
@ -1002,24 +1090,92 @@ Set a successful exit status even if pinned formulae are not upgraded\.
Retain the temporary files created during installation\. Retain the temporary files created during installation\.
. .
.TP .TP
\fB\-f\fR, \fB\-\-force\fR
Install without checking for previously installed keg\-only or non\-migrated versions\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Print the verification and postinstall steps\.
.
.TP
\fB\-\-display\-times\fR \fB\-\-display\-times\fR
Print install times for each formula at the end of the run\. Print install times for each formula at the end of the run\.
. .
.TP .TP
\fB\-n\fR, \fB\-\-dry\-run\fR \fB\-\-cask\fR
Show what would be upgraded, but do not actually upgrade anything\. Treat all named arguments as casks\. If no named arguments are specified, upgrade only outdated casks\.
.
.TP
\fB\-\-appdir\fR
Target location for Applications\. Default: \fB/Applications\fR
.
.TP
\fB\-\-colorpickerdir\fR
Target location for Color Pickers\. Default: \fB~/Library/ColorPickers\fR
.
.TP
\fB\-\-prefpanedir\fR
Target location for Preference Panes\. Default: \fB~/Library/PreferencePanes\fR
.
.TP
\fB\-\-qlplugindir\fR
Target location for QuickLook Plugins\. Default: \fB~/Library/QuickLook\fR
.
.TP
\fB\-\-mdimporterdir\fR
Target location for Spotlight Plugins\. Default: \fB~/Library/Spotlight\fR
.
.TP
\fB\-\-dictionarydir\fR
Target location for Dictionaries\. Default: \fB~/Library/Dictionaries\fR
.
.TP
\fB\-\-fontdir\fR
Target location for Fonts\. Default: \fB~/Library/Fonts\fR
.
.TP
\fB\-\-servicedir\fR
Target location for Services\. Default: \fB~/Library/Services\fR
.
.TP
\fB\-\-input_methoddir\fR
Target location for Input Methods\. Default: \fB~/Library/Input Methods\fR
.
.TP
\fB\-\-internet_plugindir\fR
Target location for Internet Plugins\. Default: \fB~/Library/Internet Plug\-Ins\fR
.
.TP
\fB\-\-audio_unit_plugindir\fR
Target location for Audio Unit Plugins\. Default: \fB~/Library/Audio/Plug\-Ins/Components\fR
.
.TP
\fB\-\-vst_plugindir\fR
Target location for VST Plugins\. Default: \fB~/Library/Audio/Plug\-Ins/VST\fR
.
.TP
\fB\-\-vst3_plugindir\fR
Target location for VST3 Plugins\. Default: \fB~/Library/Audio/Plug\-Ins/VST3\fR
.
.TP
\fB\-\-screen_saverdir\fR
Target location for Screen Savers\. Default: \fB~/Library/Screen Savers\fR
.
.TP
\fB\-\-language\fR
Set language of the Cask to install\. The first matching language is used, otherwise the default language on the Cask\. The default value is the \fBlanguage of your system\fR
.
.TP
\fB\-\-[no\-]binaries\fR
Disable/enable linking of helper executables\. Default: enabled
.
.TP
\fB\-\-require\-sha\fR
Require all casks to have a checksum\.
.
.TP
\fB\-\-[no\-]quarantine\fR
Disable/enable quarantining of downloads\. Default: enabled
.
.TP
\fB\-\-skip\-cask\-deps\fR
Skip installing cask dependencies\.
. .
.TP .TP
\fB\-\-greedy\fR \fB\-\-greedy\fR
Upgrade casks with \fBauto_updates\fR or \fBversion :latest\fR Also include casks with \fBauto_updates true\fR or \fBversion :latest\fR\.
. .
.SS "\fBuses\fR [\fIoptions\fR] \fIformula\fR" .SS "\fBuses\fR [\fIoptions\fR] \fIformula\fR"
Show formulae that specify \fIformula\fR as a dependency (i\.e\. show dependents of \fIformula\fR)\. When given multiple formula arguments, show the intersection of formulae that use \fIformula\fR\. By default, \fBuses\fR shows all formulae that specify \fIformula\fR as a required or recommended dependency for their stable builds\. Show formulae that specify \fIformula\fR as a dependency (i\.e\. show dependents of \fIformula\fR)\. When given multiple formula arguments, show the intersection of formulae that use \fIformula\fR\. By default, \fBuses\fR shows all formulae that specify \fIformula\fR as a required or recommended dependency for their stable builds\.