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