Sha256: 7b828549dc92b693756ee106b62ffb1fc38600bf836c6bddeb65cb2783c77257

Contents?: true

Size: 1.17 KB

Versions: 12

Compression:

Stored size: 1.17 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]
        if confirm(pr("break.confirmations.delete_all"))
          Byebug.breakpoints.clear
        end

        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

12 entries across 12 versions & 5 rubygems

Version Path
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/byebug-10.0.2/lib/byebug/commands/delete.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/byebug-10.0.2/lib/byebug/commands/delete.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/byebug-10.0.2/lib/byebug/commands/delete.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/byebug-10.0.2/lib/byebug/commands/delete.rb
jets-0.5.5 vendor/lambdagem/bundled/gems/ruby/2.5.0/gems/byebug-10.0.0/lib/byebug/commands/delete.rb
jets-0.5.4 vendor/lambdagem/bundled/gems/ruby/2.5.0/gems/byebug-10.0.0/lib/byebug/commands/delete.rb
jets-0.5.3 vendor/lambdagem/bundled/gems/ruby/2.5.0/gems/byebug-10.0.0/lib/byebug/commands/delete.rb
jets-0.5.2 vendor/lambdagem/bundled/gems/ruby/2.5.0/gems/byebug-10.0.0/lib/byebug/commands/delete.rb
jets-0.5.1 vendor/lambdagem/bundled/gems/ruby/2.5.0/gems/byebug-10.0.0/lib/byebug/commands/delete.rb
byebug-10.0.2 lib/byebug/commands/delete.rb
byebug-10.0.1 lib/byebug/commands/delete.rb
byebug-10.0.0 lib/byebug/commands/delete.rb