Sha256: 92e8648aee56592aca4e4954ae97234158cde198a07b31691b93c9bd5e1e217d

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

require "byebug/command"
require "byebug/helpers/parse"

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

    self.allow_in_control = true
    self.allow_in_post_mortem = true

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

    def self.description
      <<-DESCRIPTION
        del[ete][ nnn...]

        #{short_description}

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

    def self.short_description
      "Deletes breakpoints"
    end

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

        return
      end

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

        return errmsg(err) unless pos

        if Breakpoint.remove(pos)
          puts(pr("break.messages.breakpoint_deleted", pos: pos))
        else
          errmsg(pr("break.errors.no_breakpoint_delete", pos: pos))
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/byebug-11.0.1/lib/byebug/commands/delete.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/byebug-11.0.1/lib/byebug/commands/delete.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/byebug-11.0.1/lib/byebug/commands/delete.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/byebug-11.0.1/lib/byebug/commands/delete.rb
byebug-11.0.1 lib/byebug/commands/delete.rb
byebug-11.0.0 lib/byebug/commands/delete.rb