Sha256: 97a588c882ce748350d2d140a0e548ad35e29f72873aba6d58ea17d20a3b3956

Contents?: true

Size: 1.43 KB

Versions: 6

Compression:

Stored size: 1.43 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

    Install plugin:
      livetext -i filename.rb
      livetext -install filename.rb
  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 = "#{Livetext::Path}/../test/test.rb"
      flag = @backtrace ? "-back" : ""
      cmd = "ruby #{file} cmdline#{flag}"
      puts cmd
      system(cmd)
    when "-p", "--path"
      puts Livetext::Path
    when "-b", "--backtrace"
      @backtrace = true
    when "-s", "--stdin"
      src = STDIN.read
      x.process(src)
    when "-h", "--help"
      usage
    when "-i", "--install"
      lib = ARGV.shift
      system("cp #{lib} #{Livetext::Path}/../plugin/")
    when Object
      x.process_file(arg, @backtrace)
  end
end

puts x.body

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
livetext-0.8.82 bin/livetext
livetext-0.8.81 bin/livetext
livetext-0.8.80 bin/livetext
livetext-0.8.79 bin/livetext
livetext-0.8.78 bin/livetext
livetext-0.8.77 bin/livetext