aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorL. E. Segovia2017-10-20 16:51:26 -0300
committerL. E. Segovia2017-10-20 16:51:26 -0300
commit75de4db003637d871a16a73d4c7c5bc1daa88728 (patch)
tree9a9d977b05bd6a3d490ce26173f16635ea988bbb /Library
parent95a3d53125a4a93f31ddec46d9f56b6131f2b749 (diff)
downloadbrew-75de4db003637d871a16a73d4c7c5bc1daa88728.tar.bz2
Let Cask handle the -h flag
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/brew.rb8
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli.rb5
2 files changed, 9 insertions, 4 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb
index 6fd9c75c1..8d738637b 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 a77feff29..6ec3bf3b4 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