brew/Library/Homebrew/cask/cmd/internal_help.rb
2018-09-06 09:30:52 +02:00

30 lines
777 B
Ruby

module Cask
class Cmd
class InternalHelp < AbstractInternalCommand
def initialize(*)
super
return if args.empty?
raise ArgumentError, "#{self.class.command_name} does not take arguments."
end
def run
max_command_len = Cmd.commands.map(&:length).max
puts "Unstable Internal-use Commands:\n\n"
Cmd.command_classes.each do |klass|
next if klass.visible
puts " #{klass.command_name.ljust(max_command_len)} #{self.class.help_for(klass)}"
end
puts "\n"
end
def self.help_for(klass)
klass.respond_to?(:help) ? klass.help : nil
end
def self.help
"print help strings for unstable internal-use commands"
end
end
end
end