aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/brew.rb
diff options
context:
space:
mode:
authorMarkus Reiter2017-10-24 20:54:24 +0200
committerGitHub2017-10-24 20:54:24 +0200
commit632fdca2d4f2c3b82b1799bbf953a95875c87b3d (patch)
treed9493e4ff8090c9f674a33541269be5feb9a8425 /Library/Homebrew/brew.rb
parentcd61430bad2581ad7c92c4037b0c5deab84b3693 (diff)
parent09e26b1152cb66f0f1914f09a629c27a9e112b19 (diff)
downloadbrew-632fdca2d4f2c3b82b1799bbf953a95875c87b3d.tar.bz2
Merge pull request #3306 from amyspark/hacktoberfest-quash-cask-help
Fixes querying Cask commands' help
Diffstat (limited to 'Library/Homebrew/brew.rb')
-rw-r--r--Library/Homebrew/brew.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb
index 8c5386612..2cc339a83 100644
--- a/Library/Homebrew/brew.rb
+++ b/Library/Homebrew/brew.rb
@@ -78,7 +78,8 @@ begin
# - a help flag is passed AND a command is matched
# - a help flag is passed AND there is no command specified
# - no arguments are passed
- if empty_argv || help_flag
+ # - if cmd is Cask, let Cask handle the help command instead
+ if (empty_argv || help_flag) && cmd != "cask"
require "cmd/help"
Homebrew.help cmd, empty_argv: empty_argv
# `Homebrew.help` never returns, except for external/unknown commands.
@@ -116,8 +117,11 @@ begin
if Process.uid.zero? && !brew_uid.zero?
tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}]
end
+ # Unset HOMEBREW_HELP to avoid confusing the tap
+ ENV.delete("HOMEBREW_HELP") if help_flag
tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap}]
safe_system(*tap_commands)
+ ENV["HOMEBREW_HELP"] = "1" if help_flag
exec HOMEBREW_BREW_FILE, cmd, *ARGV
end
rescue UsageError => e