From 60c4e22eb000b926c54a2b56790933d5f68b9f4e Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 13 Aug 2020 22:24:40 +0200 Subject: [PATCH] Add missing `help` methods for external `cask` commands. --- Library/Homebrew/cask/cmd.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index 5e31c54d23..1ce1cb3f2b 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -230,15 +230,25 @@ module Cask end def run(*args) + command_class&.run(*args) + end + + def help + command_class&.help + end + + private + + def command_class + return @command_class if defined?(@command_class) + require @path - klass = begin + @command_class = begin Cmd.const_get(@command_name) rescue NameError - return + nil end - - klass.run(*args) end end @@ -250,6 +260,10 @@ module Cask def run(*argv) exec @path, *argv end + + def help + exec @path, "--help" + end end class UnknownSubcommand