Sha256: 1965e13ad782f2ade1f8204de2d4b940992b1c67be40512b9204449ffbacb774

Contents?: true

Size: 976 Bytes

Versions: 2

Compression:

Stored size: 976 Bytes

Contents

require 'byebug/command'
require 'byebug/helpers/parse'

module Byebug
  #
  # Implements breakpoint deletion.
  #
  class DeleteCommand < Command
    include Helpers::ParseHelper

    self.allow_in_post_mortem = false
    self.allow_in_control = true

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

    def execute
      unless @match[1]
        if confirm(pr('break.confirmations.delete_all'))
          Byebug.breakpoints.clear
        end

        return nil
      end

      @match[1].split(/ +/).each do |number|
        pos, err = get_int(number, 'Delete', 1)

        return errmsg(err) unless pos

        unless Breakpoint.remove(pos)
          return errmsg(pr('break.errors.no_breakpoint_delete', pos: pos))
        end
      end
    end

    def description
      <<-EOD
        del[ete][ nnn...]

        Without and argument, deletes all breakpoints. With integer arguments,
        it deletes specific breakpoints.
      EOD
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/byebug-5.0.0/lib/byebug/commands/delete.rb
byebug-5.0.0 lib/byebug/commands/delete.rb