Class: Clag::Commands::Help

Inherits:
Clag::Command
  • Object
show all
Defined in:
lib/clag/commands/help.rb

Instance Method Summary collapse

Instance Method Details

#call(args, _name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/clag/commands/help.rb', line 6

def call(args, _name)
  puts CLI::UI.fmt("{{bold:Available commands}}")
  puts ""

  Clag::Commands::Registry.resolved_commands.each do |name, klass|
    next if name == "help"
    puts CLI::UI.fmt("{{command:#{Clag::TOOL_NAME} #{name}}}")

    if help = klass.help
      puts CLI::UI.fmt(help)
    end

    puts ""
  end
end