Sha256: e6f292c9ca1f324bef9ec1fab9f36e2b3e6cc76b567a6840ab2354b666f0d87c

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

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

class Trepan::Subcommand::ShowHidelevel < Trepan::ShowIntSubcommand
  unless defined?(HELP)
    Trepanning::Subcommand.set_name_prefix(__FILE__, self)
    HELP = 'Show the number of stack levels to hide'
    MIN_ABBREV   = 'hide'.size
  end
  def run(args)
    if @proc.settings[:hidelevel]
      super
    else
      help = self.class.const_get(:HELP)
      msg "%s is auto selection." % help[5..-1].capitalize
    end
  end

end

if __FILE__ == $0
  # Demo it.
  require_relative '../../mock'

  # FIXME: DRY the below code
  dbgr, cmd = MockDebugger::setup('show')
  subcommand = Trepan::Subcommand::ShowHidelevel.new(cmd)

  subcommand.run(subcommand.name)
  subcommand.proc.settings[:hidelevel] = 1
  subcommand.run(subcommand.name)
  
  # require_relative '../../../../lib/trepanning'
  # dbgr = Trepan.new
  # dbgr.debugger
  subcommand.summary_help(subcommand.name)
  puts
  puts '-' * 20
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trepanning-0.1.2 processor/command/show_subcmd/hidelevel.rb
trepanning-0.1.1 processor/command/show_subcmd/hidelevel.rb
trepanning-0.1.0 processor/command/show_subcmd/hidelevel.rb