9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/caldav/caldaver.rb', line 9
def run_args( args )
o = nil
help = Proc.new do
puts o.help
exit 1
end
options = {}
o = OptionParser.new do |o|
o.on('-p', '--password', String, 'Password') { |p| options[:password] = p }
o.on('-u', '--user', String, 'User (login)') { |l| options[:login] = l }
o.on('--uri [STRING]', String, 'Calendar URI') { |uri| options[:uri] = uri }
o.on('--command [STRING]', String, 'Command') { |c| options[:command] = command }
o.on('--begin [DATETIME]', DateTime, 'Start time') { |dt| options[:begin] = dt }
o.on('--end [DATETIME]', DateTime, 'End time') { |dt| options[:end] = dt }
o.on('-h') { help.call }
end
o.parse( args )
help.call if options[:command].to_s.empty? or options[:uri].to_s.empty?
cal = cal.new( options[:uri], options[:login], options[:password] )
case options[:command].to_s
when 'create'
when 'delete'
when 'get'
when 'report'
cal.report( options[:begin], options[:end] )
else
help.call
end
end
|