Refactor CLI::InternalHelp.

This commit is contained in:
Markus Reiter 2017-05-20 03:07:37 +02:00
parent cac0c29f73
commit ed6823e659

View File

@ -1,12 +1,16 @@
module Hbc module Hbc
class CLI class CLI
class InternalHelp < InternalUseBase class InternalHelp < InternalUseBase
def self.run(*_ignored) def self.run(*args)
new(*args).run
end
def run
max_command_len = CLI.commands.map(&:length).max max_command_len = CLI.commands.map(&:length).max
puts "Unstable Internal-use Commands:\n\n" puts "Unstable Internal-use Commands:\n\n"
CLI.command_classes.each do |klass| CLI.command_classes.each do |klass|
next if klass.visible next if klass.visible
puts " #{klass.command_name.ljust(max_command_len)} #{help_for(klass)}" puts " #{klass.command_name.ljust(max_command_len)} #{self.class.help_for(klass)}"
end end
puts "\n" puts "\n"
end end