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



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/toggl_cmd/runner.rb', line 12

def self.toggl(args)
  token = IO.readlines(File.expand_path("~/.toggl")).join.strip
  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.any?        
    prettify_tasks(Toggl.new(token, NAME, options.delete(:debug)).create_task(options))
  else
    puts options.opts
  end
end