Sha256: f57de8fbb8b5daab989f4ad3e9f562c5b052ba905988b90ca31c184474644146

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

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

class Trepan::Subcommand::SetCallstyle < Trepan::Subcommand
  unless defined?(HELP)
    Trepanning::Subcommand.set_name_prefix(__FILE__, self)
    MIN_ABBREV   = 'call'.size
    MAX_ARGS     = 1
    SHORT_HELP   = 'Set how you want call parameters displayed'
    HELP         = <<-EOH
#{CMD} {short|last|tracked}

Set how you want call parameters displayed in a backtrace.
    EOH
  end

  def complete(prefix)
    Trepan::Complete.complete_token(%w(short last tracked), prefix)
  end

  def run(args)
    arg = args[2].downcase.to_sym
    case arg
    when :short, :last, :tracked
      settings[:callstyle] = arg
      Debugger.track_frame_args = (arg == :tracked) ? true : false
      @proc.commands['show'].run(%w(show callstyle))
      return
    else
      errmsg "Invalid call style #{arg}. Should be one of: " +
        "'short', 'last', or 'tracked'."
    end
  end
end

if __FILE__ == $0
  # Demo it.
  $0 = __FILE__ + 'notagain' # So we don't run this again
  require_relative '../../mock'
  cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetCallstyle, false)
  %w(short last tracked).each do |arg|
    cmd.run(cmd.prefix + [arg])
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rb8-trepanning-0.1.6 processor/command/set_subcmd/callstyle.rb
rb8-trepanning-0.1.5 processor/command/set_subcmd/callstyle.rb
rb8-trepanning-0.1.4 processor/command/set_subcmd/callstyle.rb
rb8-trepanning-0.1.3 processor/command/set_subcmd/callstyle.rb
rb8-trepanning-0.1.3-universal-ruby-1.9.2 processor/command/set_subcmd/callstyle.rb
rb8-trepanning-0.1.3-universal-ruby-1.8.7 processor/command/set_subcmd/callstyle.rb