#!/usr/bin/env ruby require 'rubygems' require 'optparse' $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'svelte' help =<<-EOS.gsub(/^\s*\|/, '').chomp | |svelte-ruby |------------------------------------------ | Ruby Gem wrapper for the Svelte compiler | Gem #{Svelte::VERSION} | JS #{Svelte::VERSION_JS} EOS ARGV << '-h' if ARGV.empty? options = {} parser = OptionParser.new do |opts| opts.banner = help + "\n\n usage: svelte [options]" opts.on('-f', '--format format', 'Format') do |format| options[:format] = format; end opts.on('-g', '--global global', 'Global') do |global| options[:global] = global; end opts.on('-i', '--input input', 'Input') do |input| options[:input] = input; end opts.on('-m', '--sourcemap sourcemap', 'Sourcemap') do |sourcemap| options[:sourcemap] = sourcemap; end opts.on('-n', '--name name', 'Name') do |name| options[:name] = name; end opts.on('-o', '--output output', 'Output') do |output| options[:output] = output; end opts.on('-d', '--dev dev', 'Dev') do |dev| options[:dev] = dev; end opts.on_tail("-h", "--help", "Show this message") do puts opts puts puts exit end end parser.parse! p options