lib/ruby-debug/command.rb in ruby-debug-ide-0.1.10 vs lib/ruby-debug/command.rb in ruby-debug-ide-0.2.0
- old
+ new
@@ -1,10 +1,26 @@
require 'ruby-debug/helper'
module Debugger
class Command # :nodoc:
+ SubcmdStruct=Struct.new(:name, :min, :short_help, :long_help) unless
+ defined?(SubcmdStruct)
+
+ # Find param in subcmds. param id downcased and can be abbreviated
+ # to the minimum length listed in the subcommands
+ def find(subcmds, param)
+ param.downcase!
+ for try_subcmd in subcmds do
+ if (param.size >= try_subcmd.min) and
+ (try_subcmd.name[0..param.size-1] == param)
+ return try_subcmd
+ end
+ end
+ return nil
+ end
+
class << self
def commands
@commands ||= []
end
@@ -65,9 +81,14 @@
else
super
end
end
+ # FIXME: use delegate?
+ def errmsg(*args)
+ @printer.print_error(*args)
+ end
+
def print(*args)
@state.print(*args)
end
# see Timeout::timeout, the difference is that we must use a DebugThread