Class: TogglCmd::Runner

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

Class Method Summary collapse

Class Method Details

.toggl(args) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/toggl_cmd/runner.rb', line 14

def self.toggl(args)
  token = team_tokens.first[1]
  options = RunnerOptions.new(args)
  if options[:tasks]
    prettify_tasks(Toggl.new(token, NAME).tasks)
  elsif options[:projects]
    prettify_projects(Toggl.new(token, NAME).projects)
  elsif options[:delete]
    toggl = Toggl.new(token, NAME)
    toggl.delete_task(options[:delete])
    prettify_tasks(toggl.tasks)
  elsif options[:dump]
    dump_tasks(options[:since], options[:through])
  elsif options.any?
    prettify_tasks(Toggl.new(token, NAME, options.delete(:debug)).create_task(options))
  else
    puts options.opts
  end
end