class Vkhal::CLI
Public Class Methods
new()
click to toggle source
# File lib/vkhal/cli.rb, line 3 def initialize @options = options_parse end
Public Instance Methods
perform()
click to toggle source
# File lib/vkhal/cli.rb, line 7 def perform if @options[:khal] ks = KhalService.new(file: @options[:khal]) ks.import! elsif @options[:show] p = Presenter.new(events: events_parse(@options[:show])) p.display end end
Private Instance Methods
events_parse(file)
click to toggle source
# File lib/vkhal/cli.rb, line 29 def events_parse(file) events_file = File.open(file) Icalendar::Event.parse(events_file) end
options_parse()
click to toggle source
# File lib/vkhal/cli.rb, line 19 def options_parse options = {} OptionParser.new do |opts| opts.banner = 'Usage: vkhal [options]' opts.on('-s', '--show FILE', String, 'Show ical file FILE') opts.on('-k', '--khal FILE', String, 'Insert ical FILE into Khal') end.parse!(into: options) options end