Sha256: cb97e495669bc969f3537a8999303f51774520f366eb065596c8f34e578a252b
Contents?: true
Size: 999 Bytes
Versions: 2
Compression:
Stored size: 999 Bytes
Contents
#!/usr/bin/env ruby require 'google_holiday_calendar' require 'optparse' options = { start_date: nil, end_date: nil, limit: 10, country: "usa", lang: "en", } opt = OptionParser.new opt.on('--start-date[=YYYY-MM-DD]', 'default: today') {|v| options[:start_date] = v } opt.on('--end-date[=YYYY-MM-DD]' , 'default: 1 month after') {|v| options[:end_date] = v } opt.on('--limit[=NUM]' , 'default; 10') {|v| options[:limit] = v.to_i } opt.on('--country[=COUNTRY]' , 'default: usa') {|v| options[:country] = v } opt.on('--lang[=LANG]' , 'default: en') {|v| options[:lang] = v } opt.parse!(ARGV) GoogleHolidayCalendar::Calendar.new( country: options[:country], lang: options[:lang], api_key: ENV["GOOGLE_API_KEY"], ).holidays( start_date: options[:start_date], end_date: options[:end_date], limit: options[:limit], ).each do |date, title| puts "#{date}: #{title}" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
google_holiday_calendar-0.1.2 | bin/google_holiday_calendar |
google_holiday_calendar-0.1.1 | bin/google_holiday_calendar |