From 75de4db003637d871a16a73d4c7c5bc1daa88728 Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" Date: Fri, 20 Oct 2017 16:51:26 -0300 Subject: [PATCH] Let Cask handle the -h flag --- Library/Homebrew/brew.rb | 8 +++++++- Library/Homebrew/cask/lib/hbc/cli.rb | 5 ++--- 2 files changed, 9 insertions(+), 4 deletions(-) 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