aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli/internal_help.rb
blob: 81d7ee673113552ea3eac0839a3c088f9572c871 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Hbc::CLI::InternalHelp < Hbc::CLI::InternalUseBase
  def self.run(*_ignored)
    max_command_len = Hbc::CLI.commands.map(&:length).max
    puts "Unstable Internal-use Commands:\n\n"
    Hbc::CLI.command_classes.each do |klass|
      next if klass.visible
      puts "    #{klass.command_name.ljust(max_command_len)}  #{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