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

Version Path
livetext-0.8.50 bin/livetext
livetext-0.8.48 bin/livetext
livetext-0.8.47 bin/livetext
livetext-0.8.46 bin/livetext
livetext-0.8.45 bin/livetext
livetext-0.8.44 bin/livetext
livetext-0.8.43 bin/livetext
livetext-0.8.42 bin/livetext
livetext-0.8.41 bin/livetext
livetext-0.8.40 bin/livetext
livetext-0.8.39 bin/livetext
livetext-0.8.38 bin/livetext
livetext-0.8.37 bin/livetext
livetext-0.8.36 bin/livetext
livetext-0.8.35 bin/livetext
livetext-0.8.34 bin/livetext
livetext-0.8.33 bin/livetext
livetext-0.8.32 bin/livetext
livetext-0.8.31 bin/livetext
livetext-0.8.30 bin/livetext