#!/usr/bin/env ruby require 'pathname' root = Pathname.new(__FILE__).realpath.parent.parent $:.unshift root.join('lib') if $0 == __FILE__ require 'optparse' require 'oddb2xml' def help < nil, :nonpharma => false, :tag_suffix => nil, } parser.on('-c v', '--compress v', /tar\.gz|zip/) {|v| opts[:compress_ext] = v } parser.on('-a v', '--append v', /nonpharma/) {|v| opts[:nonpharma] = v } parser.on('-t v', '--tag-suffix v', /^[A-z0-9_]*$/i) {|v| opts[:tag_suffix] = v.upcase } parser.on_tail('-h', '--help') { puts help; exit } args = ARGV.dup begin parser.parse!(args) rescue OptionParser::MissingArgument, OptionParser::InvalidArgument, OptionParser::InvalidOption puts help exit end ui = Oddb2xml::Cli.new(opts) begin ui.run rescue Interrupt puts exit end