Sha256: 1a182c2dc8dd5295f89b7b95dbd6ad3aa8df00b1eb2a5bedaae28a80994f7149

Contents?: true

Size: 985 Bytes

Versions: 3

Compression:

Stored size: 985 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],
).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

3 entries across 3 versions & 1 rubygems

Version Path
google_holiday_calendar-0.1.0 bin/google_holiday_calendar
google_holiday_calendar-0.0.2 bin/google_holiday_calendar
google_holiday_calendar-0.0.1 bin/google_holiday_calendar