diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index 644737c24b..38795bffe3 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -79,70 +79,6 @@ module Cask EOS end - OPTIONS = [ - [:flag, "--appdir=", { - description: "Target location for Applications. " \ - "Default: `#{Config::DEFAULT_DIRS[:appdir]}`", - }], - [:flag, "--colorpickerdir=", { - description: "Target location for Color Pickers. " \ - "Default: `#{Config::DEFAULT_DIRS[:colorpickerdir]}`", - }], - [:flag, "--prefpanedir=", { - description: "Target location for Preference Panes. " \ - "Default: `#{Config::DEFAULT_DIRS[:prefpanedir]}`", - }], - [:flag, "--qlplugindir=", { - description: "Target location for QuickLook Plugins. " \ - "Default: `#{Config::DEFAULT_DIRS[:qlplugindir]}`", - }], - [:flag, "--mdimporterdir=", { - description: "Target location for Spotlight Plugins. " \ - "Default: `#{Config::DEFAULT_DIRS[:mdimporterdir]}`", - }], - [:flag, "--dictionarydir=", { - description: "Target location for Dictionaries. " \ - "Default: `#{Config::DEFAULT_DIRS[:dictionarydir]}`", - }], - [:flag, "--fontdir=", { - description: "Target location for Fonts. " \ - "Default: `#{Config::DEFAULT_DIRS[:fontdir]}`", - }], - [:flag, "--servicedir=", { - description: "Target location for Services. " \ - "Default: `#{Config::DEFAULT_DIRS[:servicedir]}`", - }], - [:flag, "--input_methoddir=", { - description: "Target location for Input Methods. " \ - "Default: `#{Config::DEFAULT_DIRS[:input_methoddir]}`", - }], - [:flag, "--internet_plugindir=", { - description: "Target location for Internet Plugins. " \ - "Default: `#{Config::DEFAULT_DIRS[:internet_plugindir]}`", - }], - [:flag, "--audio_unit_plugindir=", { - description: "Target location for Audio Unit Plugins. " \ - "Default: `#{Config::DEFAULT_DIRS[:audio_unit_plugindir]}`", - }], - [:flag, "--vst_plugindir=", { - description: "Target location for VST Plugins. " \ - "Default: `#{Config::DEFAULT_DIRS[:vst_plugindir]}`", - }], - [:flag, "--vst3_plugindir=", { - description: "Target location for VST3 Plugins. " \ - "Default: `#{Config::DEFAULT_DIRS[:vst3_plugindir]}`", - }], - [:flag, "--screen_saverdir=", { - description: "Target location for Screen Savers. " \ - "Default: `#{Config::DEFAULT_DIRS[:screen_saverdir]}`", - }], - [:comma_array, "--language", { - description: "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`", - }], - ].freeze - def self.parser(&block) Homebrew::CLI::Parser.new do if block_given? @@ -155,9 +91,7 @@ module Cask EOS end - OPTIONS.each do |option| - send(*option) - end + cask_options end end 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/cli/named_args.rb b/Library/Homebrew/cli/named_args.rb index e82c911175..ea98cf12a8 100644 --- a/Library/Homebrew/cli/named_args.rb +++ b/Library/Homebrew/cli/named_args.rb @@ -23,21 +23,33 @@ module Homebrew super(@args) end + def to_casks + @to_casks ||= to_formulae_and_casks(only: :cask).freeze + end + def to_formulae @to_formulae ||= to_formulae_and_casks(only: :formula).freeze end - def to_formulae_and_casks(only: nil) + def to_formulae_and_casks(only: nil, method: nil) @to_formulae_and_casks ||= {} @to_formulae_and_casks[only] ||= begin - to_objects(only: only).reject { |o| o.is_a?(Tap) }.freeze + to_objects(only: only, method: method).reject { |o| o.is_a?(Tap) }.freeze end end - def load_formula_or_cask(name, only: nil) + def load_formula_or_cask(name, only: nil, method: nil) if only != :cask begin - formula = Formulary.factory(name, spec, force_bottle: @force_bottle, flags: @flags) + formula = case method + when nil, :factory + Formulary.factory(name, *spec, force_bottle: @force_bottle, flags: @flags) + when :resolve + Formulary.resolve(name, spec: spec, force_bottle: @force_bottle, flags: @flags) + else + raise + end + warn_if_cask_conflicts(name, "formula") unless only == :formula return formula rescue FormulaUnavailableError => e @@ -47,8 +59,8 @@ module Homebrew if only != :formula begin - return Cask::CaskLoader.load(name) - rescue Cask::CaskUnavailableError + return Cask::CaskLoader.load(name, config: Cask::Config.from_args(@parent)) + rescue Cask::CaskUnavailableError => e raise e if only == :cask end end @@ -58,48 +70,33 @@ module Homebrew private :load_formula_or_cask def resolve_formula(name) - Formulary.resolve(name, spec: spec(nil), force_bottle: @force_bottle, flags: @flags) + Formulary.resolve(name, spec: spec, force_bottle: @force_bottle, flags: @flags) end private :resolve_formula def to_resolved_formulae - @to_resolved_formulae ||= (downcased_unique_named - homebrew_tap_cask_names).map do |name| - resolve_formula(name) - end.uniq(&:name).freeze + @to_resolved_formulae ||= to_formulae_and_casks(only: :formula, method: :resolve) + .freeze end def to_resolved_formulae_to_casks - @to_resolved_formulae_to_casks ||= begin - resolved_formulae = [] - casks = [] - - downcased_unique_named.each do |name| - resolved_formulae << resolve_formula(name) - - warn_if_cask_conflicts(name, "formula") - rescue FormulaUnavailableError - begin - casks << Cask::CaskLoader.load(name) - rescue Cask::CaskUnavailableError - raise "No available formula or cask with the name \"#{name}\"" - end - end - - [resolved_formulae.freeze, casks.freeze].freeze - end + @to_resolved_formulae_to_casks ||= to_formulae_and_casks(method: :resolve) + .partition { |o| o.is_a?(Formula) } + .map(&:freeze).freeze end # Convert named arguments to `Tap`, `Formula` or `Cask` objects. # If both a formula and cask exist with the same name, returns the # formula and prints a warning unless `only` is specified. - def to_objects(only: nil) + def to_objects(only: nil, method: nil) @to_objects ||= {} @to_objects[only] ||= downcased_unique_named.flat_map do |name| next Tap.fetch(name) if only == :tap || (only.nil? && name.count("/") == 1 && !name.start_with?("./", "/")) - load_formula_or_cask(name, only: only) + load_formula_or_cask(name, only: only, method: method) end.uniq.freeze end + private :to_objects def to_formulae_paths to_paths(only: :formulae) @@ -132,12 +129,6 @@ module Homebrew end.uniq.freeze end - def to_casks - @to_casks ||= downcased_unique_named - .map { |name| Cask::CaskLoader.load(name, config: Cask::Config.from_args(@parent)) } - .freeze - end - def to_kegs @to_kegs ||= downcased_unique_named.map do |name| resolve_keg name @@ -187,9 +178,10 @@ module Homebrew end.uniq end - def spec(default = :stable) - @override_spec || default + def spec + @override_spec end + private :spec def resolve_keg(name) raise UsageError if name.blank? diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index be94c98aa0..179c4c17a4 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "env_config" +require "cask/config" require "cli/args" require "optparse" require "set" @@ -26,12 +27,78 @@ module Homebrew end end + def self.global_cask_options + [ + [:flag, "--appdir=", { + description: "Target location for Applications. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:appdir]}`", + }], + [:flag, "--colorpickerdir=", { + description: "Target location for Color Pickers. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:colorpickerdir]}`", + }], + [:flag, "--prefpanedir=", { + description: "Target location for Preference Panes. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:prefpanedir]}`", + }], + [:flag, "--qlplugindir=", { + description: "Target location for QuickLook Plugins. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:qlplugindir]}`", + }], + [:flag, "--mdimporterdir=", { + description: "Target location for Spotlight Plugins. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:mdimporterdir]}`", + }], + [:flag, "--dictionarydir=", { + description: "Target location for Dictionaries. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:dictionarydir]}`", + }], + [:flag, "--fontdir=", { + description: "Target location for Fonts. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:fontdir]}`", + }], + [:flag, "--servicedir=", { + description: "Target location for Services. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:servicedir]}`", + }], + [:flag, "--input_methoddir=", { + description: "Target location for Input Methods. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:input_methoddir]}`", + }], + [:flag, "--internet_plugindir=", { + description: "Target location for Internet Plugins. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:internet_plugindir]}`", + }], + [:flag, "--audio_unit_plugindir=", { + description: "Target location for Audio Unit Plugins. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:audio_unit_plugindir]}`", + }], + [:flag, "--vst_plugindir=", { + description: "Target location for VST Plugins. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:vst_plugindir]}`", + }], + [:flag, "--vst3_plugindir=", { + description: "Target location for VST3 Plugins. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:vst3_plugindir]}`", + }], + [:flag, "--screen_saverdir=", { + description: "Target location for Screen Savers. " \ + "Default: `#{Cask::Config::DEFAULT_DIRS[:screen_saverdir]}`", + }], + [:comma_array, "--language", { + description: "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`", + }], + ] + end + def self.global_options [ - ["-d", "--debug", "Display any debugging information."], - ["-q", "--quiet", "Suppress any warnings."], + ["-d", "--debug", "Display any debugging information."], + ["-q", "--quiet", "Suppress any warnings."], ["-v", "--verbose", "Make some output more verbose."], - ["-h", "--help", "Show this message."], + ["-h", "--help", "Show this message."], ] end @@ -211,6 +278,8 @@ module Homebrew else switch name, description: description end + + conflicts "--cask", name end end end @@ -254,6 +323,13 @@ module Homebrew .gsub(/\*(.*?)\*/m, "#{Tty.underline}\\1#{Tty.reset}") end + def cask_options + self.class.global_cask_options.each do |method, *args, **options| + send(method, *args, **options) + conflicts "--formula", args.last + end + end + def formula_options @formula_options = true end @@ -379,11 +455,13 @@ module Homebrew def check_named_args(args) min_exception = case @min_named_type when :cask - Cask::CaskUnspecifiedError.new + Cask::CaskUnspecifiedError when :formula - FormulaUnspecifiedError.new + FormulaUnspecifiedError + when :formula_or_cask + FormulaOrCaskUnspecifiedError when :keg - KegUnspecifiedError.new + KegUnspecifiedError else MinNamedArgumentsError.new(@min_named_args) end @@ -454,29 +532,18 @@ module Homebrew class MaxNamedArgumentsError < UsageError def initialize(maximum) - message = case maximum + super case maximum when 0 - "this command does not take named arguments" - when 1 - "this command does not take multiple named arguments" + "This command does not take named arguments." else - "this command does not take more than #{maximum} named arguments" + "This command does not take more than #{maximum} named #{"argument".pluralize(maximum)}" end - super message end end class MinNamedArgumentsError < UsageError def initialize(minimum) - message = case minimum - when 1 - "this command requires a named argument" - when 2 - "this command requires multiple named arguments" - else - "this command requires at least #{minimum} named arguments" - end - super message + super "This command requires at least #{minimum} named #{"argument".pluralize(minimum)}." end end end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 2782b4d7df..2b62240616 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -18,128 +18,111 @@ module Homebrew module_function def install_args - cask_only_options = [ - [:switch, "--cask", "--casks", { - description: "Treat all named arguments as casks.", - }], - *Cask::Cmd::OPTIONS, - *Cask::Cmd::AbstractCommand::OPTIONS, - *Cask::Cmd::Install::OPTIONS, - ] - - formula_only_options = [ - [:switch, "--formula", "--formulae", { - description: "Treat all named arguments as formulae.", - }], - [:flag, "--env=", { - description: "If `std` is passed, use the standard build environment instead of superenv. "\ - "If `super` is passed, use superenv even if the formula specifies the "\ - "standard build environment.", - }], - [:switch, "--ignore-dependencies", { - description: "An unsupported Homebrew development flag to skip installing any dependencies of "\ - "any kind. If the dependencies are not already present, the formula will have issues. "\ - "If you're not developing Homebrew, consider adjusting your PATH rather than "\ - "using this flag.", - - }], - [:switch, "--only-dependencies", { - description: "Install the dependencies with specified options but do not install the "\ - "formula itself.", - - }], - [:flag, "--cc=", { - description: "Attempt to compile using the specified , which should be the "\ - "name of the compiler's executable, e.g. `gcc-7` for GCC 7. "\ - "In order to use LLVM's clang, specify `llvm_clang`. To use the "\ - "Apple-provided clang, specify `clang`. This option will only accept "\ - "compilers that are provided by Homebrew or bundled with macOS. "\ - "Please do not file issues if you encounter errors while using this option.", - - }], - [:switch, "-s", "--build-from-source", { - description: "Compile from source even if a bottle is provided. "\ - "Dependencies will still be installed from bottles if they are available.", - - }], - [: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, "--include-test", { - description: "Install testing dependencies required to run `brew test` .", - - }], - [:switch, "--HEAD", { - description: "If defines it, install the HEAD version, aka. master, trunk, unstable.", - - }], [: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, "--keep-tmp", { - description: "Retain the temporary files created during installation.", - - }], [:switch, "--build-bottle", { - description: "Prepare the formula for eventual bottling during installation, skipping any "\ - "post-install steps.", - - }], - [:flag, "--bottle-arch=", { - depends_on: "--build-bottle", - description: "Optimise bottles for the specified architecture rather than the oldest "\ - "architecture supported by the version of macOS the bottles are built on.", - - }], - [:switch, "--display-times", { - env: :display_install_times, - description: "Print install times for each formula at the end of the run.", - }], - [: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, "-g", "--git", { - description: "Create a Git repository, useful for creating patches to the software.", - }] - ] - Homebrew::CLI::Parser.new do usage_banner <<~EOS - `install` [] + `install` [] | - Install . Additional options specific to may be appended to the command. + Install a or . Additional options specific to a may be + appended to the command. - Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the - installed formulae or, every 30 days, for all formulae. + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for + the installed formulae or, every 30 days, for all formulae. EOS 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." switch "-f", "--force", - description: "Install formulae without checking for previously installed keg-only or "\ + 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, "--formula", "--formulae", { + description: "Treat all named arguments as formulae.", + }], + [:flag, "--env=", { + description: "If `std` is passed, use the standard build environment instead of superenv. If `super` is " \ + "passed, use superenv even if the formula specifies the standard build environment.", + }], + [:switch, "--ignore-dependencies", { + description: "An unsupported Homebrew development flag to skip installing any dependencies of any kind. " \ + "If the dependencies are not already present, the formula will have issues. If you're not " \ + "developing Homebrew, consider adjusting your PATH rather than using this flag.", + }], + [:switch, "--only-dependencies", { + description: "Install the dependencies with specified options but do not install the " \ + "formula itself.", + }], + [:flag, "--cc=", { + description: "Attempt to compile using the specified , which should be the name of the " \ + "compiler's executable, e.g. `gcc-7` for GCC 7. In order to use LLVM's clang, specify " \ + "`llvm_clang`. To use the Apple-provided clang, specify `clang`. This option will only " \ + "accept compilers that are provided by Homebrew or bundled with macOS. Please do not " \ + "file issues if you encounter errors while using this option.", + }], + [:switch, "-s", "--build-from-source", { + description: "Compile from source even if a bottle is provided. " \ + "Dependencies will still be installed from bottles if they are available.", + }], + [: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, "--include-test", { + description: "Install testing dependencies required to run `brew test` .", + }], + [:switch, "--HEAD", { + description: "If defines it, install the HEAD version, aka. master, trunk, unstable.", + }], + [: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, "--keep-tmp", { + description: "Retain the temporary files created during installation.", + + }], + [:switch, "--build-bottle", { + description: "Prepare the formula for eventual bottling during installation, skipping any " \ + "post-install steps.", + }], + [:flag, "--bottle-arch=", { + depends_on: "--build-bottle", + description: "Optimise bottles for the specified architecture rather than the oldest " \ + "architecture supported by the version of macOS the bottles are built on.", + }], + [:switch, "--display-times", { + env: :display_install_times, + description: "Print install times for each formula at the end of the run.", + }], + [: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, "-g", "--git", { + description: "Create a Git repository, useful for creating patches to the software.", + }], + ].each do |*args, **options| + send(*args, **options) + conflicts "--cask", args.last + end + formula_options + [ + [:switch, "--cask", "--casks", { description: "Treat all named arguments as casks." }], + *Cask::Cmd::AbstractCommand::OPTIONS, + *Cask::Cmd::Install::OPTIONS, + ].each do |*args, **options| + send(*args, **options) + conflicts "--formula", args.last + end + cask_options conflicts "--ignore-dependencies", "--only-dependencies" conflicts "--build-from-source", "--build-bottle", "--force-bottle" - 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 - min_named :formula + min_named :formula_or_cask end end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index e19f67a5d6..1c9d62a08f 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -18,39 +18,61 @@ module Homebrew def reinstall_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `reinstall` [] + `reinstall` [] | - Uninstall and then install using the same options it was originally - installed with, plus any appended brew formula options. + Uninstall and then reinstall a or using the same options it was + originally installed with, plus any appended options specific to a . Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the reinstalled formulae or, every 30 days, for all formulae. EOS 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." - 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 "--keep-tmp", - description: "Retain the temporary files created during installation." switch "-f", "--force", - description: "Install without checking for previously installed keg-only or "\ + description: "Install without checking for previously installed keg-only or " \ "non-migrated versions." 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." - conflicts "--build-from-source", "--force-bottle" + [ + [:switch, "--formula", "--formulae", { description: "Treat all named arguments as 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, "--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.", + }], + ].each do |options| + send(*options) + conflicts "--cask", options[-2] + end formula_options - min_named :formula + [ + [:switch, "--cask", "--casks", { description: "Treat all named arguments as casks." }], + *Cask::Cmd::AbstractCommand::OPTIONS, + *Cask::Cmd::Install::OPTIONS, + ].each do |options| + send(*options) + conflicts "--formula", options[-2] + end + cask_options + + conflicts "--build-from-source", "--force-bottle" + + min_named :formula_or_cask end end @@ -61,8 +83,13 @@ module Homebrew Install.perform_preinstall_checks - resolved_formulae, casks = args.named.to_resolved_formulae_to_casks - resolved_formulae.each do |f| + only = :cask if args.cask? && !args.formula? + only = :formula if !args.cask? && args.formula? + + formulae, casks = args.named.to_formulae_and_casks(only: only, method: :resolve) + .partition { |o| o.is_a?(Formula) } + + formulae.each do |f| if f.pinned? onoe "#{f.full_name} is pinned. You must unpin it to reinstall." next @@ -74,18 +101,18 @@ module Homebrew Upgrade.check_installed_dependents(args: args) + if casks.any? + Cask::Cmd::Reinstall.reinstall_casks( + *casks, + binaries: EnvConfig.cask_opts_binaries?, + verbose: args.verbose?, + force: args.force?, + require_sha: EnvConfig.cask_opts_require_sha?, + skip_cask_deps: args.skip_cask_deps?, + quarantine: EnvConfig.cask_opts_quarantine?, + ) + end + Homebrew.messages.display_messages(display_times: args.display_times?) - - return if casks.blank? - - Cask::Cmd::Reinstall.reinstall_casks( - *casks, - binaries: EnvConfig.cask_opts_binaries?, - verbose: args.verbose?, - force: args.force?, - require_sha: EnvConfig.cask_opts_require_sha?, - skip_cask_deps: args.skip_cask_deps?, - quarantine: EnvConfig.cask_opts_quarantine?, - ) end end diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index a65fd1459f..44a32c9451 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -26,47 +26,65 @@ 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 + [ + [: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.", + }], + ].each do |options| + send(*options) + conflicts "--cask", options[-2] end formula_options + [ + [:switch, "--cask", "--casks", { + description: "Treat all named arguments as casks. If no named arguments " \ + "are specified, upgrade only outdated casks.", + }], + *Cask::Cmd::AbstractCommand::OPTIONS, + *Cask::Cmd::Upgrade::OPTIONS, + ].each do |options| + send(*options) + conflicts "--formula", options[-2] + end + cask_options + + conflicts "--build-from-source", "--force-bottle" end end diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index e34fe3cfcb..cea445b3d7 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -66,6 +66,7 @@ module Homebrew variables[:developer_commands] = generate_cmd_manpages(Commands.internal_developer_commands_paths) variables[:official_external_commands] = generate_cmd_manpages(Commands.official_external_commands_paths(quiet: quiet)) + variables[:global_cask_options] = global_cask_options_manpage variables[:global_options] = global_options_manpage variables[:environment_variables] = env_vars_manpage @@ -171,7 +172,12 @@ module Homebrew def cmd_parser_manpage_lines(cmd_parser) lines = [format_usage_banner(cmd_parser.usage_banner_text)] lines += cmd_parser.processed_options.map do |short, long, _, desc| - next if !long.nil? && Homebrew::CLI::Parser.global_options.include?([short, long, desc]) + if long.present? + next if Homebrew::CLI::Parser.global_options.include?([short, long, desc]) + next if Homebrew::CLI::Parser.global_cask_options.any? do |_, option, description:, **| + [long, "#{long}="].include?(option) && description == desc + end + end generate_option_doc(short, long, desc) end.reject(&:blank?) @@ -203,6 +209,14 @@ module Homebrew lines end + def global_cask_options_manpage + lines = ["These options are applicable to subcommands accepting a `--cask` flag and all `cask` commands.\n"] + lines += Homebrew::CLI::Parser.global_cask_options.map do |_, long, description:, **| + generate_option_doc(nil, long, description) + end + lines.join("\n") + end + def global_options_manpage lines = ["These options are applicable across multiple subcommands.\n"] lines += Homebrew::CLI::Parser.global_options.map do |short, long, desc| diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index a18499f691..35913baf0a 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -27,6 +27,13 @@ class FormulaUnspecifiedError < UsageError end end +# Raised when a command expects a formula or cask and none was specified. +class FormulaOrCaskUnspecifiedError < UsageError + def initialize + super "this command requires a formula or cask argument" + end +end + # Raised when a command expects a keg and none was specified. class KegUnspecifiedError < UsageError def initialize diff --git a/Library/Homebrew/manpages/brew-cask.1.md b/Library/Homebrew/manpages/brew-cask.1.md deleted file mode 100644 index 8b13789179..0000000000 --- a/Library/Homebrew/manpages/brew-cask.1.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 593037011f..6d4773cd77 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -59,6 +59,10 @@ If no search term is provided, all locally available formulae are listed. <%= developer_commands %> +## GLOBAL CASK OPTIONS + +<%= global_cask_options %> + ## GLOBAL OPTIONS <%= global_options %> diff --git a/docs/Manpage.md b/docs/Manpage.md index 92fe5a90fd..3b0f3ee42e 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -118,37 +118,6 @@ Commands: See also: `man brew` -* `--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` - ### `cleanup` [*`options`*] [*`formula`*|*`cask`*] Remove stale lock files and outdated downloads for all formulae and casks, @@ -304,12 +273,13 @@ If *`formula`* is provided, show summary of information about *`formula`*. * `-v`, `--verbose`: Show more verbose analytics data for *`formula`*. -### `install` [*`options`*] *`formula`* +### `install` [*`options`*] *`formula`*|*`cask`* -Install *`formula`*. Additional options specific to *`formula`* may be appended to the command. +Install a *`formula`* or *`cask`*. Additional options specific to a *`formula`* may be +appended to the command. -Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the -installed formulae or, every 30 days, for all formulae. +Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for +the installed 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. @@ -351,36 +321,6 @@ installed formulae or, every 30 days, for all formulae. Create a Git repository, useful for creating patches to the software. * `--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`: @@ -523,16 +463,22 @@ all items or checking if any current formulae/casks have Ruby issues. * `--syntax`: Syntax-check all of Homebrew's Ruby files (if no `*`tap`*` is passed). -### `reinstall` [*`options`*] *`formula`* +### `reinstall` [*`options`*] *`formula`*|*`cask`* -Uninstall and then install *`formula`* using the same options it was originally -installed with, plus any appended brew formula options. +Uninstall and then reinstall a *`formula`* or *`cask`* using the same options it was +originally installed with, plus any appended options specific to a *`formula`*. Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the 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`: @@ -541,12 +487,18 @@ 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. +* `--[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. ### `search` [*`options`*] [*`text`*|`/`*`text`*`/`] @@ -680,10 +632,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`: @@ -696,16 +652,20 @@ 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. +* `--[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`* @@ -1360,6 +1320,55 @@ If no options are passed, use `origin/master` as the start commit. Install and commit Homebrew's vendored gems. +## GLOBAL CASK OPTIONS + +These options are applicable to subcommands accepting a `--cask` flag and all `cask` commands. + +* `--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` + ## GLOBAL OPTIONS These options are applicable across multiple subcommands. @@ -1859,6 +1868,7 @@ See our issues on GitHub: [ESSENTIAL COMMANDS]: #ESSENTIAL-COMMANDS "ESSENTIAL COMMANDS" [COMMANDS]: #COMMANDS "COMMANDS" [DEVELOPER COMMANDS]: #DEVELOPER-COMMANDS "DEVELOPER COMMANDS" +[GLOBAL CASK OPTIONS]: #GLOBAL-CASK-OPTIONS "GLOBAL CASK OPTIONS" [GLOBAL OPTIONS]: #GLOBAL-OPTIONS "GLOBAL OPTIONS" [OFFICIAL EXTERNAL COMMANDS]: #OFFICIAL-EXTERNAL-COMMANDS "OFFICIAL EXTERNAL COMMANDS" [CUSTOM EXTERNAL COMMANDS]: #CUSTOM-EXTERNAL-COMMANDS "CUSTOM EXTERNAL COMMANDS" diff --git a/manpages/brew.1 b/manpages/brew.1 index 2140c06953..512be112c6 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -172,66 +172,6 @@ Zaps all files associated with the given \fIcask\fR .P See also: \fBman brew\fR . -.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 -. .SS "\fBcleanup\fR [\fIoptions\fR] [\fIformula\fR|\fIcask\fR]" Remove stale lock files and outdated downloads for all formulae and casks, and remove old versions of installed formulae\. If arguments are specified, only do this for the given formulae and casks\. Removes all downloads more than 120 days old\. This can be adjusted with \fBHOMEBREW_CLEANUP_MAX_AGE_DAYS\fR\. . @@ -445,8 +385,8 @@ Print JSON of all available formulae\. \fB\-v\fR, \fB\-\-verbose\fR Show more verbose analytics data for \fIformula\fR\. . -.SS "\fBinstall\fR [\fIoptions\fR] \fIformula\fR" -Install \fIformula\fR\. Additional options specific to \fIformula\fR may be appended to the command\. +.SS "\fBinstall\fR [\fIoptions\fR] \fIformula\fR|\fIcask\fR" +Install a \fIformula\fR or \fIcask\fR\. Additional options specific to a \fIformula\fR may be appended to the command\. . .P Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will then be run for the installed formulae or, every 30 days, for all formulae\. @@ -532,66 +472,6 @@ Create a Git repository, useful for creating patches to the software\. 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 . @@ -779,8 +659,8 @@ Verify any alias symlinks in each tap\. \fB\-\-syntax\fR Syntax\-check all of Homebrew\'s Ruby files (if no \fB\fR is passed)\. . -.SS "\fBreinstall\fR [\fIoptions\fR] \fIformula\fR" -Uninstall and then install \fIformula\fR using the same options it was originally installed with, plus any appended brew formula options\. +.SS "\fBreinstall\fR [\fIoptions\fR] \fIformula\fR|\fIcask\fR" +Uninstall and then reinstall a \fIformula\fR or \fIcask\fR using the same options it was originally installed with, plus any appended options specific to a \fIformula\fR\. . .P Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will then be run for the reinstalled formulae or, every 30 days, for all formulae\. @@ -790,6 +670,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 +698,29 @@ 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\-\-[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\. +. .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 +874,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 +914,32 @@ 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\-\-[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\. @@ -1908,6 +1828,69 @@ Use the commit at the specified \fIdate\fR as the start commit\. .SS "\fBvendor\-gems\fR" Install and commit Homebrew\'s vendored gems\. . +.SH "GLOBAL CASK OPTIONS" +These options are applicable to subcommands accepting a \fB\-\-cask\fR flag and all \fBcask\fR commands\. +. +.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 +. .SH "GLOBAL OPTIONS" These options are applicable across multiple subcommands\. .