Sha256: 5086cbb0beaea05fa53aa056671b094c097d7c6cb03016b34b34b2c29925dea1

Contents?: true

Size: 1.15 KB

Versions: 7141

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require_relative "../command"
require_relative "../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

7,141 entries across 7,138 versions & 34 rubygems

Version Path
cybrid_api_id_ruby-0.123.310 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_bank_ruby-0.123.310 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_organization_ruby-0.123.310 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_organization_ruby-0.123.309 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_bank_ruby-0.123.309 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_id_ruby-0.123.309 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_bank_ruby-0.123.307 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_organization_ruby-0.123.307 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_id_ruby-0.123.307 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_bank_ruby-0.123.306 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_id_ruby-0.123.306 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_organization_ruby-0.123.306 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_bank_ruby-0.123.305 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_id_ruby-0.123.305 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_organization_ruby-0.123.305 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_organization_ruby-0.123.303 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_bank_ruby-0.123.303 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_id_ruby-0.123.303 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_bank_ruby-0.123.302 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb
cybrid_api_organization_ruby-0.123.302 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/delete.rb