#!/usr/bin/env ruby require "#{File.dirname(__FILE__)}/../lib/divvy" require 'optparse' require 'ostruct' options = OpenStruct.new options.verbose = false options.test = false parser = OptionParser.new do |opts| opts.banner = < #{File.basename($0)} [options] Options are: BANNER opts.separator "" opts.on("-s", "--script=PATH", "The divvy script to run") do |script| options.script = script end opts.on("-t", "--[no-]test", "Process but do not perform actions") do |t| options.test = t end opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| options.verbose = v end opts.on("-h", "--help", "Show this help message.") { puts opts; exit } opts.parse!(ARGV) unless options.script puts "script is required" puts opts exit end end Divvy.init Divvy.test = options.test Divvy.verbose = options.verbose Divvy.run(File.read(options.script), options.script)