Fix brew cask <command> --help.

This commit is contained in:
Markus Reiter 2020-05-19 19:30:46 +02:00
parent 6d9a20614a
commit 7f400d8e4e
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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