#!/usr/bin/env ruby $:.unshift(File.dirname(__FILE__) + '/../lib') require 'revenc' require 'optparse' require 'term/ansicolor' available_actions = Revenc::AVAILABLE_ACTIONS banner = < Unmount: revenc unmount Copy: revenc copy Note: Copying is normally done via rsync Options: HELP options = {} OptionParser.new do |opts| opts.banner = help # set defaults options[:verbose] = false options[:coloring] = true opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| options[:verbose] = v end opts.on("-c", "--[no-]coloring", "Ansi color in output") do |c| options[:coloring] = c end opts.on("--version", "Display current version") do puts "revenc, version " + Revenc.version exit 0 end opts.on("-d", "--dry-run", "Run action but omit the final execute step. Useful combined with --verbose") do |d| options[:dry_run] = d end opts.on("--config FILE", "Load configuration options from FILE") do |file| options[:config] = file end # no argument, shows at tail. This will print an options summary. opts.on_tail("-h", "--help", "Show this message") do puts opts exit 0 end begin opts.parse! rescue OptionParser::InvalidOption => e puts "revenc #{e}" puts "revenc --help for more information" exit 1 end end if STDOUT.isatty Term::ANSIColor::coloring = options[:coloring] else Term::ANSIColor::coloring = false end app = Revenc::App.new(FileUtils.pwd, options) app.run