Add helpful error message when attempting to run brew cask
This commit is contained in:
parent
385892f3d2
commit
f18cbd2066
@ -86,6 +86,10 @@ 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
|
||||
|
||||
@ -30,6 +30,13 @@ 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