Method: Interactive#print_tasks

Defined in:
lib/interactive.rb


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/interactive.rb', line 56

def print_tasks
  task_len = TaskFormatter.max_length(@tasks)

  puts @header
  @tasks.each_with_index do |task, i|
    @formatter.format(task, task_len)

    print "\e[47m" + "\e[30m" if i == @task_selected
    print @formatter.line_for_interactive
    print "\e[0m" if i == @task_selected
    print '  ' + @formatter.sync_status
    print "\033[K"
    puts ''
  end
  total_time = Utils.format_time(@tasks.map(&:duration).reduce(:+))
  puts "\e[100m  #{''.ljust(task_len, ' ')} #{total_time}  #{''.rjust(@formatter.bar_size, ' ')}  \e[0m\033[K"

  puts "\033[K"
  print "\033[#{@tasks.length + 3}A"
end