Class | Debugger::HelpCommand |
In: |
cli/ruby-debug/commands/help.rb
|
Parent: | Command |
Implements debugger "help" command.
The code that implements this command.
# File cli/ruby-debug/commands/help.rb, line 14 14: def execute 15: if @match[1] 16: args = @match[1].split 17: cmds = @state.commands.select do |cmd| 18: [cmd.help_command].flatten.include?(args[0]) 19: end 20: else 21: args = @match[1] 22: cmds = [] 23: end 24: unless cmds.empty? 25: help = cmds.map{ |cmd| cmd.help(args) }.join 26: help = help.split("\n").map{|l| l.gsub(/^ +/, '')} 27: help.shift if help.first && help.first.empty? 28: help.pop if help.last && help.last.empty? 29: print help.join("\n") 30: else 31: if args and args[0] 32: errmsg "Undefined command: \"#{args[0]}\". Try \"help\"." 33: else 34: print "ruby-debug help v#{Debugger::VERSION}\n" unless 35: self.class.settings[:debuggertesting] 36: print "Type 'help <command-name>' for help on a specific command\n\n" 37: print "Available commands:\n" 38: cmds = @state.commands.map{ |cmd| cmd.help_command } 39: cmds = cmds.flatten.uniq.sort 40: print columnize(cmds, self.class.settings[:width]) 41: end 42: end 43: print "\n" 44: end