Sha256: 13d0d5140936c07b21b497e5ea2f98f6c45a2894e65910b883c6886065ac2ef4

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

#!/usr/bin/env ruby

require "textbringer"

include Textbringer
include Commands

def load_user_config
  config_file = File.expand_path("~/.textbringer.rb")
  begin
    load(config_file)
  rescue LoadError
  end
end

$VERBOSE = nil

Controller.current = Controller.new
Window.start do
  begin
    load_user_config
    ruby_mode
    if ARGV.size > 0
      ARGV.each do |arg|
        find_file(arg)
      end
    end
    if Buffer.dumped_buffers_exist?(CONFIG[:buffer_dump_dir])
      Window.redisplay
      if yes_or_no?("Dumped buffers found; restore them?")
        buffers = Buffer.load_dumped_buffers(CONFIG[:buffer_dump_dir])
        switch_to_buffer(buffers.last)
      end
    end
  rescue Exception => e
    handle_exception(e)
  end
  Window.redisplay
  begin
    trap(:CONT) { Window.redraw }
  rescue ArgumentError
  end
  begin
    loop do
      Controller.current.command_loop(TOP_LEVEL_TAG)
      Window.redisplay
    end
  rescue Exception => e
    if !e.is_a?(SystemExit)
      Buffer.dump_unsaved_buffers(CONFIG[:buffer_dump_dir])
    end
    raise
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
textbringer-0.1.7 exe/textbringer
textbringer-0.1.6 exe/textbringer
textbringer-0.1.5 exe/textbringer
textbringer-0.1.4 exe/textbringer
textbringer-0.1.3 exe/textbringer
textbringer-0.1.2 exe/textbringer