#!/usr/bin/env ruby $:.unshift(File::join(File::dirname(File::dirname(__FILE__)), "lib")) require 'meteo/meteo_cli' params = [] units = "imperial" forecast = 0 index = 0 while index < ARGV.size do param = ARGV[index] if param =~ /--units=/ or param =~ /-u=/ units = ARGV[index][ARGV[index].index("=")+1..-1] elsif param =~ /--units/ or param =~ /-u/ units = ARGV[index+1] index = index + 1 elsif param =~ /--forecast=/ or param =~ /-f=/ forecast = ARGV[index][ARGV[index].index("=")+1..-1] elsif param =~ /--forecast/ or param =~ /-f/ forecast = ARGV[index+1] index = index + 1 else params << param end index = index + 1 end MeteoCLI.start ["quote", "--units=#{units}", "--forecast=#{forecast}", "#{params.join(' ')}"]