class Byebug::DeleteBreakpointCommand

Implements byebug “delete” command.

def description

def description
  %{
    del[ete][ nnn...]
    Without argumen, deletes all breakpoints. With integer numbers,
    deletes specific breakpoints.
  }
end

def execute

def execute
  return errmsg "We are not in a state we can delete breakpoints.\n" unless @state.context
  brkpts = @match[1]
  unless brkpts
    if confirm("Delete all breakpoints? (y or n) ")
      Byebug.breakpoints.clear
    end
  else
    brkpts.split(/[ \t]+/).each do |pos|
      pos = get_int(pos, "Delete", 1)
      return unless pos
      unless Byebug.remove_breakpoint(pos)
        errmsg "No breakpoint number %d\n", pos
      end
    end
  end
end

def names

def names
  %w(delete)
end

def regexp

def regexp
  /^\s *del(?:ete)? (?:\s+(.*))?$/ix
end