Sha256: 9aecefd9e23e2e80a691ff05d214a4edd3cbc7f5d64a0e83a54517fadc883f46
Contents?: true
Size: 1.83 KB
Versions: 6
Compression:
Stored size: 1.83 KB
Contents
#!/usr/bin/env ruby require 'rubygems' require_relative '../lib/livetext' def usage STDERR.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 exit end def version puts "#{Livetext::VERSION}\n " end def testing file = "#{Livetext::Path}/../test/test.rb" flag = @backtrace ? "-back" : "" cmd = "ruby #{file} cmdline#{flag}" puts cmd system(cmd) end def mixin_flag mod = ARGV.shift @live.mixin(ARGV.shift) end def read_stdin src = STDIN.read @live.process(src) end def install_plugin lib = ARGV.shift system("cp #{lib} #{Livetext::Path}/../plugin/") end def parse_command_line usage if ARGV.empty? success = true loop do arg = ARGV.shift break if arg.nil? case arg when "-v", "--version"; version when "-t", "--test"; testing when "-p", "--path"; puts Livetext::Path when "-b", "--backtrace"; @backtrace = true when "-m", "--mixin" mixin_flag next when "-s", "--stdin"; read_stdin when "-h", "--help"; usage when "-i", "--install"; install_plugin when Object; @live.process_file(arg, true) # , @backtrace) else success = false STDERR.puts "Command line - #{arg.inspect} is unknown" end end @live.dump if success # rescue => err # STDERR.puts "Unexpected error! #{err.inspect}" end # Main @live = Livetext.new @backtrace = false parse_command_line
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
livetext-0.9.32 | bin/livetext |
livetext-0.9.31 | bin/livetext |
livetext-0.9.30 | bin/livetext |
livetext-0.9.27 | bin/livetext |
livetext-0.9.26 | bin/livetext |
livetext-0.9.25 | bin/livetext |