#!/usr/bin/env ruby require "style_stats" require 'optparse' options = {} opt = OptionParser.new opt.banner = 'Usage: style_stats [options] ' opt.on('-h', '--help', 'output usage information') do puts opt exit end opt.on('-V', '--version', 'output the version number') do |v| puts StyleStats::VERSION exit end opt.on('-c', '--config ', 'set configurations') { |v| options[:config] = v } opt.on('-f', '--format ', 'set the output format ') { |v| options[:format] = v } opt.on('-t', '--template ', 'set the template path for output format') { |v| options[:template] = v } opt.on('-m', '--mobile [name]', 'set the mobile user agent') { |v| options[:user_agent] = v || 'ios' } opt.on('--user-anget ', 'set the user agent') { |v| options[:user_agent] = v } opt.parse!(ARGV) if ARGV.empty? puts opt else StyleStats::CLI.run(ARGV, options) end