Sha256: d4239ea343aa60ad4407bb0b581ca12e731d5ab80da2cf435e5aa46da3dbeedc

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

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

module Byebug
  #
  # Remove expressions from display list.
  #
  class UndisplayCommand < Command
    include Helpers::ParseHelper

    self.allow_in_post_mortem = false

    def regexp
      /^\s* undisp(?:lay)? (?:\s+(\S+))? \s*$/x
    end

    def execute
      if @match[1]
        pos, err = get_int(@match[1], 'Undisplay', 1, @state.display.size)
        return errmsg(err) unless err.nil?

        unless @state.display[pos - 1]
          return errmsg(pr('display.errors.undefined', expr: pos))
        end

        @state.display[pos - 1][0] = nil
      else
        return unless confirm(pr('display.confirmations.clear_all'))

        @state.display.each { |d| d[0] = false }
      end
    end

    def description
      <<-EOD
        undisp[lay][ nnn]

        Cancel some expressions to be displayed when program stops. Arguments
        are the code numbers of the expressions to stop displaying. No argument
        means cancel all automatic-display expressions. "delete display" has the
        same effect as this command. Do "info display" to see the current list
        of code numbers.
      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/undisplay.rb
byebug-5.0.0 lib/byebug/commands/undisplay.rb