Sha256: 5d6ddb47e7d297551f9138edcdebb30db255114236f1f61bfb5b613e91c678da

Contents?: true

Size: 1.05 KB

Versions: 23

Compression:

Stored size: 1.05 KB

Contents

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
      <<-EOD
        del[ete][ nnn...]

        #{short_description}

        Without and argument, deletes all breakpoints. With integer arguments,
        it deletes specific breakpoints.
      EOD
    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

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

Version data entries

23 entries across 22 versions & 2 rubygems

Version Path
tdiary-5.0.5 vendor/bundle/gems/byebug-9.0.6/lib/byebug/commands/delete.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/byebug-9.0.6/lib/byebug/commands/delete.rb
tdiary-5.0.4 vendor/bundle/gems/byebug-9.0.6/lib/byebug/commands/delete.rb
byebug-9.0.6 lib/byebug/commands/delete.rb
byebug-9.0.5 lib/byebug/commands/delete.rb
byebug-9.0.4 lib/byebug/commands/delete.rb
byebug-9.0.3 lib/byebug/commands/delete.rb
byebug-9.0.2 lib/byebug/commands/delete.rb
byebug-9.0.1 lib/byebug/commands/delete.rb
byebug-9.0.0 lib/byebug/commands/delete.rb
byebug-8.2.5 lib/byebug/commands/delete.rb
byebug-8.2.4 lib/byebug/commands/delete.rb
byebug-8.2.3 lib/byebug/commands/delete.rb
byebug-8.2.2 lib/byebug/commands/delete.rb
byebug-8.2.1 lib/byebug/commands/delete.rb
byebug-8.2.0 lib/byebug/commands/delete.rb
byebug-8.1.0 lib/byebug/commands/delete.rb
byebug-8.0.1 lib/byebug/commands/delete.rb
byebug-8.0.0 lib/byebug/commands/delete.rb
byebug-7.0.0 lib/byebug/commands/delete.rb