From 7f14e55f997b70d5ff829b510928f040e59aed05 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 28 Sep 2020 02:34:14 +0200 Subject: [PATCH] Add missing cask options to `brew upgrade`. --- Library/Homebrew/cask/cmd/upgrade.rb | 17 ++- Library/Homebrew/cmd/upgrade.rb | 91 +++++++----- docs/Manpage.md | 106 ++++++++++++-- manpages/brew.1 | 202 ++++++++++++++++++++++++--- 4 files changed, 342 insertions(+), 74 deletions(-) diff --git a/Library/Homebrew/cask/cmd/upgrade.rb b/Library/Homebrew/cask/cmd/upgrade.rb index 2f0d183288..e83cb4dd39 100644 --- a/Library/Homebrew/cask/cmd/upgrade.rb +++ b/Library/Homebrew/cask/cmd/upgrade.rb @@ -13,16 +13,25 @@ module Cask "Upgrades all outdated casks or the specified casks." 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 super do switch "--force", 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", description: "Show what would be upgraded, but do not actually upgrade anything." + + OPTIONS.each do |option| + send(*option) + end end end diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index a65fd1459f..fe7b6fc2bb 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -12,6 +12,51 @@ module Homebrew module_function 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 from source even if a bottle is available.", + }], + [:switch, "-i", "--interactive", { + description: "Download and patch , 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 usage_banner <<~EOS `upgrade` [] [|] @@ -26,46 +71,26 @@ module Homebrew switch "-d", "--debug", description: "If brewing fails, open an interactive debugging session with access to IRB "\ "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 from source even if a bottle is available." - switch "-i", "--interactive", - description: "Download and patch , 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", - description: "Install without checking for previously installed keg-only or "\ - "non-migrated versions." + description: "Install formulae without checking for previously installed keg-only or "\ + "non-migrated versions. Overwrite existing files when installing casks." switch "-v", "--verbose", 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", 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 "--formula", "--greedy" - ["--formula", "-s", "--build-from-source", "-i", "--interactive", - "--force-bottle", "--fetch-HEAD", "--ignore-pinned", "--keep-tmp", - "--display-times"].each do |flag| - conflicts "--cask", flag + + formula_only_options.each do |options| + send(*options) + conflicts "--cask", options[-2] end + + cask_only_options.each do |options| + send(*options) + conflicts "--formula", options[-2] + end + formula_options end end diff --git a/docs/Manpage.md b/docs/Manpage.md index 7018ba68a2..3298d50e85 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -534,6 +534,12 @@ reinstalled formulae or, every 30 days, for all formulae. * `-d`, `--debug`: 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`: Compile *`formula`* from source even if a bottle is available. * `-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. * `--keep-tmp`: 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`: 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`*`/`] @@ -681,10 +721,14 @@ upgraded formulae or, every 30 days, for all formulae. * `-d`, `--debug`: 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`: - Only upgrade outdated formulae. -* `--cask`: - Only upgrade outdated casks. + Treat all named arguments as formulae. If no named argumentsare specified, upgrade only outdated formulae. * `-s`, `--build-from-source`: Compile *`formula`* from source even if a bottle is available. * `-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. * `--keep-tmp`: 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`: Print install times for each formula at the end of the run. -* `-n`, `--dry-run`: - Show what would be upgraded, but do not actually upgrade anything. +* `--cask`: + 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`: - Upgrade casks with `auto_updates` or `version :latest` + Also include casks with `auto_updates true` or `version :latest`. ### `uses` [*`options`*] *`formula`* diff --git a/manpages/brew.1 b/manpages/brew.1 index cde4acbc8a..ec67fdec6e 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -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\. . .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 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\. . .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 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]" 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\. . .TP -\fB\-\-formula\fR -Only upgrade outdated formulae\. +\fB\-f\fR, \fB\-\-force\fR +Install formulae without checking for previously installed keg\-only or non\-migrated versions\. Overwrite existing files when installing casks\. . .TP -\fB\-\-cask\fR -Only upgrade outdated casks\. +\fB\-v\fR, \fB\-\-verbose\fR +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 \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\. . .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 Print install times for each formula at the end of the run\. . .TP -\fB\-n\fR, \fB\-\-dry\-run\fR -Show what would be upgraded, but do not actually upgrade anything\. +\fB\-\-cask\fR +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 \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" 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\.