Class: Rubinius::Debugger::Command::Help

Inherits:
Rubinius::Debugger::Command show all
Defined in:
lib/rubinius/debugger/commands.rb

Overview

Commands =====

These classes are in the order they should appear in the help output. As such, they’re grouped by similar action.

Instance Method Summary collapse

Methods inherited from Rubinius::Debugger::Command

commands, #current_frame, #current_method, descriptor, ext_help, help, #initialize, #listen, match?, pattern, #run_code, #variables

Methods included from Display

#ask, #crit, #display, #error, #info, #section

Constructor Details

This class inherits a constructor from Rubinius::Debugger::Command

Instance Method Details

#run(args) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/rubinius/debugger/commands.rb', line 79

def run(args)

  if args and !args.empty?
    klass = Command.commands.find { |k| k.match?(args.strip) }
    if klass
      des = klass.descriptor
      puts "Help for #{des.name}:"
      puts "  Accessed using: #{des.patterns.join(', ')}"
      puts "\n#{des.help}."
      puts "\n#{des.ext_help}" if des.ext_help
    else
      puts "Unknown command: #{args}"
    end
  else
    Command.commands.each do |klass|
      des = klass.descriptor

      puts "%20s: #{des.help}" % des.patterns.join(', ')
    end
  end
end