Sha256: 5e0ab1b1c1aed34de05353a395224dd953ab2414fb8c7ba3a379ccdd6c3ca5fd

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

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

class Trepan::Subcommand::SetAutoList < Trepan::SetBoolSubSubcommand
  unless defined?(HELP)
    HELP = "Set to run a 'list' command each time we enter the debugger"
    MIN_ABBREV = 'l'.size
    NAME       = File.basename(__FILE__, '.rb')
    PREFIX     = %w(set auto list)
    SHORT_HELP = "Set running a 'list' command each time we enter the debugger"
  end

  def run(args)
    super
    if @proc.settings[:autolist]
      @proc.cmdloop_prehooks.insert_if_new(10, *@proc.autolist_hook)
    else
      @proc.cmdloop_prehooks.delete_by_name('autolist')
    end
  end

end

if __FILE__ == $0
  # Demo it.
  require_relative '../../../mock'
  require_relative '../auto'
  cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetAuto,
                                   Trepan::SubSubcommand::SetAutoList)
  %w(off on 0 1).each { |arg| cmd.run([cmd.name, arg]) }
  puts '-' * 10
  puts cmd.save_command.join("\n")
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trepanning-0.1.2 processor/command/set_subcmd/auto_subcmd/list.rb
trepanning-0.1.1 processor/command/set_subcmd/auto_subcmd/list.rb
trepanning-0.1.0 processor/command/set_subcmd/auto_subcmd/list.rb
trepanning-0.0.9 processor/command/set_subcmd/auto_subcmd/list.rb
trepanning-0.0.8 processor/command/set_subcmd/auto_subcmd/list.rb