Class: Timekeeper::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/timekeeper/runner.rb

Class Method Summary collapse

Class Method Details

.tk(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/timekeeper/runner.rb', line 5

def self.tk(args)
  options = KeeperOptions.new(args)
  if options.any?
    tk = Keeper.new
    tk.config(options.delete(:config)) if options[:config]
    
    if id = options[:remove]
      tk.delete(id)
    elsif id = options.delete(:update)
      tk.update(id, options)
    else        
      tk.store(options)          
    end
  else
    puts options.opts
  end
end

.tv(args) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/timekeeper/runner.rb', line 23

def self.tv(args)
  options = ViewerOptions.new(args)
  tv = Viewer.new
  tv.config(options.delete(:config)) if options[:config]      
  records = tv.all
  if output = options.delete(:output)
    Viewer.export(records, output[0], output[1])
  else
    puts records
  end
end