class Byebug::Command
end
end
# My command’s implementation
def execute
end
’Custom short desc’
def.short_description
end
’Custom long desc’
def self.description
end
/custom_regexp/
def self.regexp
class MyCustomCommand < Command
@example
your own custom command.
Subclass it and name the subclass ending with the word Command to implement
Parent class of all byebug commands.
def always_run
def always_run @always_run ||= 0 end
def arguments
def arguments @match[0].split(' ').drop(1).join(' ') end
def columnize(width)
def columnize(width) format(" %-#{width}s -- %s\n", to_s, short_description) end
def context
def context @context ||= processor.context end
def frame
def frame @frame ||= context.frame end
def help
Default help text for a command.
def help prettify(description) end
def initialize(processor, input = self.class.to_s)
def initialize(processor, input = self.class.to_s) @processor = processor @match = match(input) end
def match(input)
Command's regexp match against an input
def match(input) regexp.match(input) end
def to_s
Name of the command, as executed by the user.
def to_s name .split('::') .map { |n| n.gsub(/Command$/, '').downcase if n =~ /Command$/ } .compact .join(' ') end