diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index f789cc3748..a51b6f0890 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -54,13 +54,23 @@ module Cask }.freeze DEPRECATED_COMMANDS = { - Cmd::Cache => "brew --cache --cask", + Cmd::Cache => "brew --cache [--cask]", + Cmd::Audit => "brew audit [--cask]", + Cmd::Cat => "brew cat [--cask]", + Cmd::Create => "brew create --cask --set-name ", Cmd::Doctor => "brew doctor --verbose", + Cmd::Edit => "brew edit [--cask]", + Cmd::Fetch => "brew fetch [--cask]", Cmd::Home => "brew home", - Cmd::List => "brew list --cask", - Cmd::Outdated => "brew outdated --cask", - Cmd::Reinstall => "brew reinstall", - Cmd::Upgrade => "brew upgrade --cask", + Cmd::Info => "brew info [--cask]", + Cmd::Install => "brew install [--cask]", + Cmd::List => "brew list [--cask]", + Cmd::Outdated => "brew outdated [--cask]", + Cmd::Reinstall => "brew reinstall [--cask]", + Cmd::Style => "brew style", + Cmd::Uninstall => "brew uninstall [--cask]", + Cmd::Upgrade => "brew upgrade [--cask]", + Cmd::Zap => "brew upgrade --zap [--cask]", }.freeze sig { returns(String) } diff --git a/Library/Homebrew/cask/cmd/edit.rb b/Library/Homebrew/cask/cmd/edit.rb index ca01e711c3..8036352a31 100644 --- a/Library/Homebrew/cask/cmd/edit.rb +++ b/Library/Homebrew/cask/cmd/edit.rb @@ -35,7 +35,9 @@ module Cask exec_editor cask_path rescue CaskUnavailableError => e reason = e.reason.empty? ? +"" : +"#{e.reason} " - reason.concat("Run #{Formatter.identifier("brew cask create #{e.token}")} to create a new Cask.") + reason.concat( + "Run #{Formatter.identifier("brew create --cask --set-name #{e.token} ")} to create a new Cask.", + ) raise e.class.new(e.token, reason.freeze) end diff --git a/Library/Homebrew/cask/cmd/uninstall.rb b/Library/Homebrew/cask/cmd/uninstall.rb index 4fd6ac8980..6a70b9b77e 100644 --- a/Library/Homebrew/cask/cmd/uninstall.rb +++ b/Library/Homebrew/cask/cmd/uninstall.rb @@ -64,7 +64,7 @@ module Cask puts <<~EOS #{cask} #{versions.to_sentence} #{"is".pluralize(versions.count)} still installed. - Remove #{(versions.count == 1) ? "it" : "them all"} with `brew cask uninstall --force #{cask}`. + Remove #{(versions.count == 1) ? "it" : "them all"} with `brew uninstall --cask --force #{cask}`. EOS end end diff --git a/Library/Homebrew/cask/dsl/caveats.rb b/Library/Homebrew/cask/dsl/caveats.rb index 9673fbc368..705a6b35c9 100644 --- a/Library/Homebrew/cask/dsl/caveats.rb +++ b/Library/Homebrew/cask/dsl/caveats.rb @@ -112,17 +112,17 @@ module Cask if java_version == :any <<~EOS #{@cask} requires Java. You can install the latest version with: - brew cask install adoptopenjdk + brew install --cask adoptopenjdk EOS elsif java_version.include?("11") || java_version.include?("+") <<~EOS #{@cask} requires Java #{java_version}. You can install the latest version with: - brew cask install adoptopenjdk + brew install --cask adoptopenjdk EOS else <<~EOS #{@cask} requires Java #{java_version}. You can install it with: - brew cask install homebrew/cask-versions/adoptopenjdk#{java_version} + brew install --cask homebrew/cask-versions/adoptopenjdk#{java_version} EOS end end diff --git a/Library/Homebrew/cask/exceptions.rb b/Library/Homebrew/cask/exceptions.rb index 9778c29725..34cd2b62ab 100644 --- a/Library/Homebrew/cask/exceptions.rb +++ b/Library/Homebrew/cask/exceptions.rb @@ -111,7 +111,7 @@ module Cask sig { returns(String) } def to_s - %Q(Cask '#{token}' already exists. Run #{Formatter.identifier("brew cask edit #{token}")} to edit it.) + %Q(Cask '#{token}' already exists. Run #{Formatter.identifier("brew edit --cask #{token}")} to edit it.) end end @@ -142,7 +142,7 @@ module Cask def to_s <<~EOS Cask '#{token}' requires XQuartz/X11, which can be installed using Homebrew Cask by running: - #{Formatter.identifier("brew cask install xquartz")} + #{Formatter.identifier("brew install --cask xquartz")} or manually, by downloading the package from: #{Formatter.url("https://www.xquartz.org/")} diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 23eda92fe7..c93530edec 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -474,7 +474,7 @@ module Cask end def zap - ohai %Q(Implied "brew cask uninstall #{@cask}") + ohai %Q(Implied "brew uninstall --cask #{@cask}") uninstall_artifacts if (zap_stanzas = @cask.artifacts.select { |a| a.is_a?(Artifact::Zap) }).empty? opoo "No zap stanza present for Cask '#{@cask}'" diff --git a/Library/Homebrew/cmd/home.rb b/Library/Homebrew/cmd/home.rb index 2308392968..2dfa1c8f41 100644 --- a/Library/Homebrew/cmd/home.rb +++ b/Library/Homebrew/cmd/home.rb @@ -1,7 +1,8 @@ -# typed: false +# typed: true # frozen_string_literal: true require "cli/parser" +require "formula" module Homebrew extend T::Sig @@ -12,14 +13,15 @@ module Homebrew def home_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `home` [] + `home` [|] - Open 's homepage in a browser, or open Homebrew's own homepage - if no formula is provided. + Open a or 's homepage in a browser, or open + Homebrew's own homepage if no argument is provided. EOS end end + sig { void } def home args = home_args.parse diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 24406a4764..76d563a959 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -322,7 +322,7 @@ class Reporter new_tap.install unless new_tap.installed? ohai "#{name} has been moved to Homebrew.", <<~EOS To uninstall the cask run: - brew cask uninstall --force #{name} + brew uninstall --cask --force #{name} EOS next if (HOMEBREW_CELLAR/new_name.split("/").last).directory? @@ -352,8 +352,8 @@ class Reporter system HOMEBREW_BREW_FILE, "unlink", name ohai "brew cleanup" system HOMEBREW_BREW_FILE, "cleanup" - ohai "brew cask install #{new_name}" - system HOMEBREW_BREW_FILE, "cask", "install", new_name + ohai "brew install --cask #{new_name}" + system HOMEBREW_BREW_FILE, "install", "--cask", new_name ohai <<~EOS #{name} has been moved to Homebrew Cask. The existing keg has been unlinked. @@ -365,7 +365,7 @@ class Reporter To uninstall the formula and install the cask run: brew uninstall --force #{name} brew tap #{new_tap_name} - brew cask install #{new_name} + brew install --cask #{new_name} EOS end else diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index 032a8df0aa..f34f0c762b 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -30,11 +30,11 @@ module Homebrew description: "When passed with `--write`, generate a new commit after writing changes "\ "to the cask file." switch "--no-audit", - description: "Don't run `brew cask audit` before opening the PR." + description: "Don't run `brew audit` before opening the PR." switch "--online", - description: "Run `brew cask audit --online` before opening the PR." + description: "Run `brew audit --online` before opening the PR." switch "--no-style", - description: "Don't run `brew cask style --fix` before opening the PR." + description: "Don't run `brew style --fix` before opening the PR." switch "--no-browse", description: "Print the pull request URL instead of opening in a browser." switch "--no-fork", @@ -232,49 +232,49 @@ module Homebrew def run_cask_audit(cask, old_contents, args:) if args.dry_run? if args.no_audit? - ohai "Skipping `brew cask audit`" + ohai "Skipping `brew audit`" elsif args.online? - ohai "brew cask audit --online #{cask.sourcefile_path.basename}" + ohai "brew audit --cask --online #{cask.sourcefile_path.basename}" else - ohai "brew cask audit #{cask.sourcefile_path.basename}" + ohai "brew audit --cask #{cask.sourcefile_path.basename}" end return end failed_audit = false if args.no_audit? - ohai "Skipping `brew cask audit`" + ohai "Skipping `brew audit`" elsif args.online? - system HOMEBREW_BREW_FILE, "cask", "audit", "--online", cask.sourcefile_path + system HOMEBREW_BREW_FILE, "audit", "--cask", "--online", cask.sourcefile_path failed_audit = !$CHILD_STATUS.success? else - system HOMEBREW_BREW_FILE, "cask", "audit", cask.sourcefile_path + system HOMEBREW_BREW_FILE, "audit", "--cask", cask.sourcefile_path failed_audit = !$CHILD_STATUS.success? end return unless failed_audit cask.sourcefile_path.atomic_write(old_contents) - odie "`brew cask audit` failed!" + odie "`brew audit` failed!" end def run_cask_style(cask, old_contents, args:) if args.dry_run? if args.no_style? - ohai "Skipping `brew cask style --fix`" + ohai "Skipping `brew style --fix`" else - ohai "brew cask style --fix #{cask.sourcefile_path.basename}" + ohai "brew style --fix #{cask.sourcefile_path.basename}" end return end failed_style = false if args.no_style? - ohai "Skipping `brew cask style --fix`" + ohai "Skipping `brew style --fix`" else - system HOMEBREW_BREW_FILE, "cask", "style", "--fix", cask.sourcefile_path + system HOMEBREW_BREW_FILE, "style", "--fix", cask.sourcefile_path failed_style = !$CHILD_STATUS.success? end return unless failed_style cask.sourcefile_path.atomic_write(old_contents) - odie "`brew cask style --fix` failed!" + odie "`brew style --fix` failed!" end end diff --git a/Library/Homebrew/extend/os/mac/missing_formula.rb b/Library/Homebrew/extend/os/mac/missing_formula.rb index 37ec0c0273..7ad5199b52 100644 --- a/Library/Homebrew/extend/os/mac/missing_formula.rb +++ b/Library/Homebrew/extend/os/mac/missing_formula.rb @@ -23,13 +23,13 @@ module Homebrew There are three versions of MacTeX. Full installation: - brew cask install mactex + brew install --cask mactex Full installation without bundled applications: - brew cask install mactex-no-gui + brew install --cask mactex-no-gui Minimal installation: - brew cask install basictex + brew install --cask basictex EOS else generic_disallowed_reason(name) @@ -47,7 +47,7 @@ module Homebrew def suggest_command(name, command) suggestion = <<~EOS Found a cask named "#{name}" instead. Try - brew cask #{command} #{name} + brew #{command} --cask #{name} EOS case command diff --git a/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb index 958602973e..cb044513ea 100644 --- a/Library/Homebrew/missing_formula.rb +++ b/Library/Homebrew/missing_formula.rb @@ -30,7 +30,7 @@ module Homebrew EOS when "macruby" then <<~EOS MacRuby has been discontinued. Consider RubyMotion: - brew cask install rubymotion + brew install --cask rubymotion EOS when /(lib)?lzma/ then <<~EOS lzma is now part of the xz formula: @@ -74,8 +74,8 @@ module Homebrew when "ngrok" then <<~EOS Upstream sunsetted 1.x in March 2016 and 2.x is not open-source. - If you wish to use the 2.x release you can install with Homebrew Cask: - brew cask install ngrok + If you wish to use the 2.x release you can install it with: + brew install --cask ngrok EOS when "cargo" then <<~EOS cargo is part of the rust formula: diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 5078ac7bd7..11a87bc433 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -43,8 +43,8 @@ class Requirement s = "#{class_name} unsatisfied!\n" if cask s += <<~EOS - You can install with Homebrew Cask: - brew cask install #{cask} + You can install the necessary cask with: + brew install --cask #{cask} EOS end diff --git a/Library/Homebrew/requirements/java_requirement.rb b/Library/Homebrew/requirements/java_requirement.rb index fdee4f4e03..cf6b944d42 100644 --- a/Library/Homebrew/requirements/java_requirement.rb +++ b/Library/Homebrew/requirements/java_requirement.rb @@ -75,7 +75,7 @@ class JavaRequirement < Requirement title_string = " #{title}" if title <<~EOS Install#{title_string} with Homebrew Cask: - brew cask install #{token} + brew install --cask #{token} EOS end end diff --git a/Library/Homebrew/test/cask/cmd_spec.rb b/Library/Homebrew/test/cask/cmd_spec.rb index d034437fcd..36b55ebbdb 100644 --- a/Library/Homebrew/test/cask/cmd_spec.rb +++ b/Library/Homebrew/test/cask/cmd_spec.rb @@ -11,6 +11,10 @@ describe Cask::Cmd, :cask do context "::run" do let(:noop_command) { double("Cmd::Noop", run: nil) } + before do + allow(Homebrew).to receive(:raise_deprecation_exceptions?).and_return(false) + end + it "prints help output when subcommand receives `--help` flag" do expect { described_class.run("info", "--help") diff --git a/Library/Homebrew/test/missing_formula_spec.rb b/Library/Homebrew/test/missing_formula_spec.rb index 56985f3478..e6b2dd644a 100644 --- a/Library/Homebrew/test/missing_formula_spec.rb +++ b/Library/Homebrew/test/missing_formula_spec.rb @@ -97,7 +97,7 @@ describe Homebrew::MissingFormula do let(:show_info) { false } it { is_expected.to match(/Found a cask named "local-caffeine" instead./) } - it { is_expected.to match(/Try\n brew cask install local-caffeine/) } + it { is_expected.to match(/Try\n brew install --cask local-caffeine/) } end context "with a formula name that is a cask and show_info: true" do @@ -123,7 +123,7 @@ describe Homebrew::MissingFormula do let(:command) { "install" } it { is_expected.to match(/Found a cask named "local-caffeine" instead./) } - it { is_expected.to match(/Try\n brew cask install local-caffeine/) } + it { is_expected.to match(/Try\n brew install --cask local-caffeine/) } end context "brew uninstall" do @@ -138,7 +138,7 @@ describe Homebrew::MissingFormula do end it { is_expected.to match(/Found a cask named "local-caffeine" instead./) } - it { is_expected.to match(/Try\n brew cask uninstall local-caffeine/) } + it { is_expected.to match(/Try\n brew uninstall --cask local-caffeine/) } end end diff --git a/Library/Homebrew/test/requirements/java_requirement_spec.rb b/Library/Homebrew/test/requirements/java_requirement_spec.rb index a33c25928c..95835ce2f7 100644 --- a/Library/Homebrew/test/requirements/java_requirement_spec.rb +++ b/Library/Homebrew/test/requirements/java_requirement_spec.rb @@ -138,21 +138,21 @@ describe JavaRequirement do describe "#suggestion" do context "without specific version" do - its(:suggestion) { is_expected.to match(/brew cask install adoptopenjdk/) } + its(:suggestion) { is_expected.to match(/brew install --cask adoptopenjdk/) } its(:cask) { is_expected.to eq("adoptopenjdk") } end context "with version 1.8" do subject { described_class.new(%w[1.8]) } - its(:suggestion) { is_expected.to match(%r{brew cask install homebrew/cask-versions/adoptopenjdk8}) } + its(:suggestion) { is_expected.to match(%r{brew install --cask homebrew/cask-versions/adoptopenjdk8}) } its(:cask) { is_expected.to eq("homebrew/cask-versions/adoptopenjdk8") } end context "with version 1.8+" do subject { described_class.new(%w[1.8+]) } - its(:suggestion) { is_expected.to match(/brew cask install adoptopenjdk/) } + its(:suggestion) { is_expected.to match(/brew install --cask adoptopenjdk/) } its(:cask) { is_expected.to eq("adoptopenjdk") } end end diff --git a/docs/Manpage.md b/docs/Manpage.md index 9e25a8c0c8..261f8dee81 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -71,39 +71,9 @@ Homebrew Cask provides a friendly CLI workflow for the administration of macOS a Commands: -- `audit` -
Check *`cask`* for Homebrew coding style violations. - -- `cat` -
Dump raw source of a *`cask`* to the standard output. - -- `create` -
Creates the given *`cask`* and opens it in an editor. - -- `edit` -
Open the given *`cask`* for editing. - -- `fetch` -
Downloads remote application files to local cache. - - `help`
Print help for `cask` commands. -- `info` -
Displays information about the given *`cask`*. - -- `install` -
Installs the given *`cask`*. - -- `style` -
Checks style of the given *`cask`* using RuboCop. - -- `uninstall` -
Uninstalls the given *`cask`*. - -- `zap` -
Zaps all files associated with the given *`cask`*. - See also: `man brew` ### `cleanup` [*`options`*] [*`formula`*|*`cask`*] @@ -243,10 +213,10 @@ error message if no logs are found. * `-p`, `--private`: The Gist will be marked private and will not appear in listings but will be accessible with its link. -### `home` [*`formula`*] +### `home` [*`formula`*|*`cask`*] -Open *`formula`*'s homepage in a browser, or open Homebrew's own homepage -if no formula is provided. +Open a *`formula`* or *`cask`*'s homepage in a browser, or open +Homebrew's own homepage if no argument is provided. ### `info` [*`options`*] [*`formula`*|*`cask`*] @@ -849,11 +819,11 @@ supplied by the user. * `--commit`: When passed with `--write`, generate a new commit after writing changes to the cask file. * `--no-audit`: - Don't run `brew cask audit` before opening the PR. + Don't run `brew audit` before opening the PR. * `--online`: - Run `brew cask audit --online` before opening the PR. + Run `brew audit --online` before opening the PR. * `--no-style`: - Don't run `brew cask style --fix` before opening the PR. + Don't run `brew style --fix` before opening the PR. * `--no-browse`: Print the pull request URL instead of opening in a browser. * `--no-fork`: diff --git a/manpages/brew.1 b/manpages/brew.1 index ffa16f11d4..a2becbf847 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -67,71 +67,11 @@ Homebrew Cask provides a friendly CLI workflow for the administration of macOS a Commands: . .TP -\fBaudit\fR -. -.br -Check \fIcask\fR for Homebrew coding style violations\. -. -.TP -\fBcat\fR -. -.br -Dump raw source of a \fIcask\fR to the standard output\. -. -.TP -\fBcreate\fR -. -.br -Creates the given \fIcask\fR and opens it in an editor\. -. -.TP -\fBedit\fR -. -.br -Open the given \fIcask\fR for editing\. -. -.TP -\fBfetch\fR -. -.br -Downloads remote application files to local cache\. -. -.TP \fBhelp\fR . .br Print help for \fBcask\fR commands\. . -.TP -\fBinfo\fR -. -.br -Displays information about the given \fIcask\fR\. -. -.TP -\fBinstall\fR -. -.br -Installs the given \fIcask\fR\. -. -.TP -\fBstyle\fR -. -.br -Checks style of the given \fIcask\fR using RuboCop\. -. -.TP -\fBuninstall\fR -. -.br -Uninstalls the given \fIcask\fR\. -. -.TP -\fBzap\fR -. -.br -Zaps all files associated with the given \fIcask\fR\. -. .P See also: \fBman brew\fR . @@ -322,8 +262,8 @@ Automatically create a new issue in the appropriate GitHub repository after crea \fB\-p\fR, \fB\-\-private\fR The Gist will be marked private and will not appear in listings but will be accessible with its link\. . -.SS "\fBhome\fR [\fIformula\fR]" -Open \fIformula\fR\'s homepage in a browser, or open Homebrew\'s own homepage if no formula is provided\. +.SS "\fBhome\fR [\fIformula\fR|\fIcask\fR]" +Open a \fIformula\fR or \fIcask\fR\'s homepage in a browser, or open Homebrew\'s own homepage if no argument is provided\. . .SS "\fBinfo\fR [\fIoptions\fR] [\fIformula\fR|\fIcask\fR]" Display brief statistics for your Homebrew installation\. @@ -1173,15 +1113,15 @@ When passed with \fB\-\-write\fR, generate a new commit after writing changes to . .TP \fB\-\-no\-audit\fR -Don\'t run \fBbrew cask audit\fR before opening the PR\. +Don\'t run \fBbrew audit\fR before opening the PR\. . .TP \fB\-\-online\fR -Run \fBbrew cask audit \-\-online\fR before opening the PR\. +Run \fBbrew audit \-\-online\fR before opening the PR\. . .TP \fB\-\-no\-style\fR -Don\'t run \fBbrew cask style \-\-fix\fR before opening the PR\. +Don\'t run \fBbrew style \-\-fix\fR before opening the PR\. . .TP \fB\-\-no\-browse\fR