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] command, args = detect_internal_command(*args) || detect_external_command(*args) || [NullCommand.new, args]
if help? if help?
puts command.help Help.new(command.command_name).run
else else
command.run(*args) command.run(*args)
end end

View File

@ -11,12 +11,15 @@ module Cask
elsif args.count == 1 elsif args.count == 1
command_name = args.first command_name = args.first
if (command = self.class.commands[command_name]) && command.respond_to?(:usage) unless command = self.class.commands[command_name]
puts command.usage raise "No help information found for command '#{command_name}'."
return
end end
raise "No help information found for command '#{command_name}'." if command.respond_to?(:usage)
puts command.usage
else
puts command.help
end
else else
raise ArgumentError, "#{self.class.command_name} only takes up to one argument." raise ArgumentError, "#{self.class.command_name} only takes up to one argument."
end end