Sha256: ed9fd60fd85b22fcae95ec1bc532d7ea76ffb12f3514abac8d234c3585dccf6b
Contents?: true
Size: 1.21 KB
Versions: 21
Compression:
Stored size: 1.21 KB
Contents
#!/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 def usage puts <<-EOF Usage: livetext filename Read STDIN livetext -s livetext --stdin Show help: livetext livetext -h livetext --help Show path: livetext -p livetext --path Run tests: livetext -t livetext --test Show version: livetext -v livetext --version Turn on backtrace: livetext -b livetext --backtrace EOF puts exit end usage if ARGV.empty? loop do arg = ARGV.shift break if arg.nil? case arg when "-v", "--version" puts "#{Livetext::VERSION}\n " when "-t", "--test" file = "#{Path}/../test/test.rb" flag = @backtrace ? "-back" : "" cmd = "ruby #{file} cmdline#{flag}" puts cmd system(cmd) when "-p", "--path" puts Path when "-b", "--backtrace" @backtrace = true when "-s", "--stdin" src = STDIN.read x.process(src) when "-h", "--help" usage when Object x.process_file(arg, @backtrace) end end
Version data entries
21 entries across 21 versions & 1 rubygems