Simplify 'brew cask' check
This commit is contained in:
parent
f18cbd2066
commit
9e2c5910c5
@ -86,10 +86,6 @@ begin
|
||||
require "commands"
|
||||
require "settings"
|
||||
|
||||
# Print an error message and exit if the command is no longer supported
|
||||
unsupported_cmd_message = Commands.unsupported_cmd?(cmd)
|
||||
odie unsupported_cmd_message if unsupported_cmd_message
|
||||
|
||||
internal_cmd = Commands.valid_internal_cmd?(cmd) || Commands.valid_internal_dev_cmd?(cmd) if cmd
|
||||
|
||||
unless internal_cmd
|
||||
@ -125,6 +121,9 @@ begin
|
||||
possible_tap = Tap.fetch(possible_tap.first) if possible_tap
|
||||
|
||||
if !possible_tap || possible_tap.installed? || Tap.untapped_official_taps.include?(possible_tap.name)
|
||||
if cmd == 'cask' # Check for cask explicitly because it's very common in old guides
|
||||
odie "`brew cask <command>` is no longer supported. Use `brew <command> --cask` instead."
|
||||
end
|
||||
odie "Unknown command: #{cmd}"
|
||||
end
|
||||
|
||||
|
@ -30,13 +30,6 @@ module Commands
|
||||
"lc" => "livecheck",
|
||||
"tc" => "typecheck",
|
||||
}.freeze
|
||||
HOMEBREW_UNSUPPORTED_COMMAND_MESSAGES = {
|
||||
"cask" => "`brew cask <command>` is no longer supported. Use `brew <command> --cask` instead.",
|
||||
}.freeze
|
||||
|
||||
def unsupported_cmd?(cmd)
|
||||
HOMEBREW_UNSUPPORTED_COMMAND_MESSAGES.fetch(cmd, nil)
|
||||
end
|
||||
|
||||
def valid_internal_cmd?(cmd)
|
||||
require?(HOMEBREW_CMD_PATH/cmd)
|
||||
|
Loading…
x
Reference in New Issue
Block a user