diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 6fd9c75c1f..8d738637b4 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -80,7 +80,13 @@ begin # - no arguments are passed if empty_argv || help_flag require "cmd/help" - Homebrew.help cmd, empty_argv: empty_argv + if cmd == "cask" + # Let Cask handle the help command + Homebrew.send cmd.to_s.tr("-", "_").downcase + exit 0 + else + Homebrew.help cmd, empty_argv: empty_argv + end # `Homebrew.help` never returns, except for external/unknown commands. end diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index a77feff29e..6ec3bf3b41 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -154,7 +154,7 @@ module Hbc def run command_name, *args = detect_command_and_arguments(*@args) command = if help? - args.unshift(command_name) + args.unshift(command_name) if !command_name.nil? "help" else self.class.lookup_command(command_name) @@ -230,8 +230,7 @@ module Hbc return if @command == "help" && @args.empty? - unknown_command = (@command == "help") ? @args.first : @command - raise ArgumentError, "Unknown command: #{unknown_command}" + raise ArgumentError, "help does not take arguments" end def purpose