diff options
| author | Markus Reiter | 2017-10-24 20:54:24 +0200 | 
|---|---|---|
| committer | GitHub | 2017-10-24 20:54:24 +0200 | 
| commit | 632fdca2d4f2c3b82b1799bbf953a95875c87b3d (patch) | |
| tree | d9493e4ff8090c9f674a33541269be5feb9a8425 | |
| parent | cd61430bad2581ad7c92c4037b0c5deab84b3693 (diff) | |
| parent | 09e26b1152cb66f0f1914f09a629c27a9e112b19 (diff) | |
| download | brew-632fdca2d4f2c3b82b1799bbf953a95875c87b3d.tar.bz2 | |
Merge pull request #3306 from amyspark/hacktoberfest-quash-cask-help
Fixes querying Cask commands' help
| -rw-r--r-- | Library/Homebrew/brew.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli.rb | 5 | 
2 files changed, 7 insertions, 4 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 diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index 9283802d5..e147c8280 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) unless 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 = @args.empty? ? @command : @args.first -        raise ArgumentError, "Unknown command: #{unknown_command}" +        raise ArgumentError, "help does not take arguments."        end        def purpose | 
