#!/usr/bin/env ruby require 'rubygems' require_relative '../lib/livetext' def handle_lt3(src) abort "Unknown file extension" unless src =~ /.lt3$/ end # Main x = Livetext.new @backtrace = false loop do arg = ARGV.shift break if arg.nil? case arg when "-v", "--version" puts "#{Livetext::VERSION}\n " when "-t", "--test" # FIXME doesn't work - path problem file = "#{Path}/../test/test.rb" flag = @backtrace ? "-back" : "" cmd = "ruby #{file} cmdline#{flag}" puts cmd system(cmd) when "--path" puts Path when "--backtrace" @backtrace = true when "-s", "--stdin" src = STDIN.read x.process(src) when nil puts <<-EOF Usage: livetext -v livetext --version livetext filename EOF puts when Object x.process_file(arg, @backtrace) end end