class Byebug::Command


Subclasses need to implement a ‘regexp` and an `execute` command.
Parent class of all byebug commands.

def allow_in_post_mortem

def allow_in_post_mortem
  !defined?(@allow_in_post_mortem) ? true : false
end

def always_run

def always_run
  @always_run ||= 0
end

def bb_eval(str, b = get_binding)


error full stack trace and error are printed.
Evaluates a string containing Ruby code, using binding +b+. In case of
def bb_eval(str, b = get_binding)
  b.eval(str)
rescue StandardError, ScriptError => e
  at = e.backtrace
  locations = []
  locations << "#{at.shift}: #{e.class} Exception(#{e.message})"
  locations += at.map { |path| "\tfrom #{path}" }
  errmsg(pr('eval.exception', text_message: locations.join("\n")))
  nil
end

def bb_warning_eval(str, b = get_binding)


error, an error message with the exception is printed.
Evaluates a string containing Ruby code, using binding +b+. In case of
def bb_warning_eval(str, b = get_binding)
  b.eval(str)
rescue StandardError, ScriptError => e
  text_message = "#{e.class} Exception: #{e.message}"
  errmsg(pr('eval.exception', text_message: text_message))
  nil
end

def commands

def commands
  @commands ||= []
end

def find(subcmds, str)

def find(subcmds, str)
  str.downcase!
  subcmds.each do |subcmd|
    if (str.size >= subcmd.min) && (subcmd.name[0..str.size - 1] == str)
      return subcmd
    end
  end
  nil
end

def format_subcmd(subcmd_name)

def format_subcmd(subcmd_name)
  subcmd = find(self::Subcommands, subcmd_name)
  return "Invalid \"#{names.join('|')}\" " \
         "subcommand \"#{args[1]}\"." unless subcmd
  "\n  #{subcmd.help}.\n\n"
end

def format_subcmds

def format_subcmds
  header = names.join('|')
  s = "  List of \"#{header}\" subcommands:\n  --\n"
  w = self::Subcommands.map(&:name).max_by(&:size).size
  self::Subcommands.each do |subcmd|
    s += format("  %s %-#{w}s -- %s\n", header, subcmd.name, subcmd.help)
  end
  s + "\n"
end

def get_binding(pos = @state.frame)

def get_binding(pos = @state.frame)
  @state.context ? @state.context.frame_binding(pos) : TOPLEVEL_BINDING
end

def help(subcmd = nil)

def help(subcmd = nil)
  return format_subcmd(subcmd) if subcmd
  output = description
  output += format_subcmds if defined? self::Subcommands
  output
end

def inherited(klass)

def inherited(klass)
  commands << klass
end

def initialize(state)

def initialize(state)
  @match, @state = nil, state
end

def match(input)

def match(input)
  @match = regexp.match(input)
end