Class: TasksCLI::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/tasks_cli/cli.rb

Instance Method Summary collapse

Instance Method Details

#filter(filter_string) ⇒ Object



13
14
15
16
17
18
# File 'lib/tasks_cli/cli.rb', line 13

def filter(filter_string)
  manager = TaskManager.new
  key, value = filter_string.split(':')
  filtered_tasks = manager.filter_tasks({ key => value })
  print_tasks(filtered_tasks)
end

#listObject



7
8
9
10
# File 'lib/tasks_cli/cli.rb', line 7

def list
  manager = TaskManager.new
  print_tasks(manager.all_tasks)
end

#update(number, status) ⇒ Object



32
33
34
35
# File 'lib/tasks_cli/cli.rb', line 32

def update(number, status)
  manager = TaskManager.new
  manager.update_status(number, status)
end

#view(number) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/tasks_cli/cli.rb', line 21

def view(number)
  manager = TaskManager.new
  task = manager.find_task(number)
  if task
    puts task.detailed_view
  else
    puts Rainbow("Task not found").red
  end
end