diff --git a/task.go b/task.go index c3f8bfe..9859d85 100644 --- a/task.go +++ b/task.go @@ -92,61 +92,3 @@ func (t *TaskRunner) updateUI(msg Message) { msg.Pomodoros, ) } - -/* - -// Task Starting.. -// -// 20min remaning [pomodoro 1/4] -// .. -// 15min remaining [pomodoro 2/4] -// .. -// Task Completed! -func display(writer io.Writer, msg Message) { - fmt.Fprintf( - writer, - "%s %s remaining [ pomodoro %d/%d ]\n", - msg.Wheel, - (msg.Duration - time.Since(msg.Start)).Truncate(time.Second), - msg.CurrentPomodoro, - msg.Pomodoros, - ) -} - -func run(task Task, notifier Notifier, db *Store) { - taskID, err := db.CreateTask(task) - maybe(err) - writer := uilive.New() - writer.Start() - ticker := time.NewTicker(RefreshInterval) - timer := time.NewTimer(task.Duration) - wheel := &Wheel{} - var p int - for p < task.NPomodoros { - pomodoro := &Pomodoro{} - maybe(notifier.Begin(task)) - pomodoro.Start = time.Now() - timer.Reset(task.Duration) - loop: - select { - case <-ticker.C: - display(writer, Message{ - Start: pomodoro.Start, - Duration: task.Duration, - Pomodoros: task.NPomodoros, - Wheel: wheel, - CurrentPomodoro: p, - }) - goto loop - case <-timer.C: - maybe(notifier.Break(task)) - fmt.Println("press enter to take a break") - pomodoro.End = time.Now() - maybe(db.CreatePomodoro(taskID, *pomodoro)) - p++ - } - } - maybe(notifier.Finish(task)) - writer.Stop() -} -*/