Sha256: 39ce0aa82f7a28cdbfd42d2eda6e7e98ae6061bf0a9a18a775c1da2790114dcc

Contents?: true

Size: 1.47 KB

Versions: 8

Compression:

Stored size: 1.47 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
require 'rubygems'; require 'require_relative'
require_relative 'base/cmd'

# undisplay display-number...
class Trepan::Command::UndisplayCommand < Trepan::Command
    
  unless defined?(HELP)
    NAME = File.basename(__FILE__, '.rb')
    HELP = <<EOH
undisplay DISPLAY_NUMBER ...
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 current list of code numbers.
EOH

    ALIASES       = %w(und)
    CATEGORY      = 'data'
    NEED_STACK    = false
    SHORT_HELP    = 'Cancel some expressions to be displayed when program stops'
  end

  def run(args)
    
    if args.size == 1
      @proc.displays.clear
      return
    end
    opts = {}
    args[1..-1].each do |arg|
      opts[:msg_on_error] = '%s must be a display number' % arg
      i = @proc.get_an_int(arg, opts)
      if i 
        unless @proc.displays.delete_index(i)
          errmsg("no display number %d." % i)
          return
        end
      end
      return false
    end
  end
end

if __FILE__ == $0
  # demo it.
  require_relative '../mock'
  dbgr, cmd = MockDebugger::setup

  def run_cmd(cmd, args)
    cmd.run(args)
    puts '==' * 10
  end

  run_cmd(cmd, %W(#{cmd.name} z))
  run_cmd(cmd, %W(#{cmd.name} 1 10))
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
rb8-trepanning-0.1.3 processor/command/undisplay.rb
rb8-trepanning-0.1.3-universal-ruby-1.9.2 processor/command/undisplay.rb
rb8-trepanning-0.1.3-universal-ruby-1.8.7 processor/command/undisplay.rb
rbx-trepanning-0.0.8-universal-rubinius-1.2 processor/command/undisplay.rb
rbx-trepanning-0.0.7-universal-rubinius-1.2 processor/command/undisplay.rb
rbx-trepanning-0.0.6-universal-rubinius-1.2 processor/command/undisplay.rb
rbx-trepanning-0.0.5-universal-rubinius-1.2.1 processor/command/undisplay.rb
rbx-trepanning-0.0.4-universal-rubinius-1.2 processor/command/undisplay.rb