#!/usr/bin/env ruby require "drb" require "optparse" eval = false wait = true uri = "drbunix:" + File.expand_path("server.sock", "~/.textbringer") opt = OptionParser.new opt.banner = "Usage: tbclient [OPTIONS] FILE" opt.on("--uri URI", "Specify the URI of the server") do |val| uri = val end opt.on("-e", "--eval", "Evaluate FILE as a Ruby expression") do eval = true end opt.on("-n", "--no-wait", "Don't wait for the server") do wait = false end args = ARGV.dup opt.parse!(args) if args.empty? STDERR.puts(opt.help) exit 1 end arg = args.first tb = DRbObject.new_with_uri(uri) if eval puts tb.eval(arg) else tb.visit_file(File.expand_path(arg), wait: wait) end