From 7f400d8e4e21e4f5fc00132890467734f1290055 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 19 May 2020 19:30:46 +0200 Subject: [PATCH] Fix `brew cask --help`. --- Library/Homebrew/cask/cmd.rb | 2 +- Library/Homebrew/cask/cmd/help.rb | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index af03b04385..8e93128b32 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -145,7 +145,7 @@ module Cask command, args = detect_internal_command(*args) || detect_external_command(*args) || [NullCommand.new, args] if help? - puts command.help + Help.new(command.command_name).run else command.run(*args) end diff --git a/Library/Homebrew/cask/cmd/help.rb b/Library/Homebrew/cask/cmd/help.rb index bfda5ab9a9..28db5331b7 100644 --- a/Library/Homebrew/cask/cmd/help.rb +++ b/Library/Homebrew/cask/cmd/help.rb @@ -11,12 +11,15 @@ module Cask elsif args.count == 1 command_name = args.first - if (command = self.class.commands[command_name]) && command.respond_to?(:usage) - puts command.usage - return + unless command = self.class.commands[command_name] + raise "No help information found for command '#{command_name}'." end - raise "No help information found for command '#{command_name}'." + if command.respond_to?(:usage) + puts command.usage + else + puts command.help + end else raise ArgumentError, "#{self.class.command_name} only takes up to one argument." end