Sha256: 841806909f303ff6528ffa4c3b91f29572b00afdf034231f4983ccfb1c6dc8e6

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

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

class Trepan::Subcommand::SetHighlight < Trepan::SetBoolSubcommand
  unless defined?(HELP)
    Trepanning::Subcommand.set_name_prefix(__FILE__, self)
    HELP       = 'Set whether we use terminal highlighting'
    IN_LIST    = true
    MIN_ABBREV = 'hi'.size
  end

  def complete(prefix)
    Trepan::Complete.complete_token(%w(on off reset), prefix)
  end

  def run(args)
    if args.size == 3 && 'reset' == args[2]
      LineCache::clear_file_format_cache
      @proc.settings[:highlight] = :term 
    else
      super
      @proc.settings[:highlight] = :term if @proc.settings[:highlight]
    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::SetHighlight, false)
  cmd.run(cmd.prefix + ['off'])
  cmd.run(cmd.prefix + ['ofn'])
  cmd.run(cmd.prefix)
  puts cmd.save_command
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trepanning-0.1.6 processor/command/set_subcmd/highlight.rb
trepanning-0.1.4 processor/command/set_subcmd/highlight.rb
trepanning-0.1.3 processor/command/set_subcmd/highlight.rb