ChronoTomato/internal/notifications/terminal.go

52 lines
1.1 KiB
Go

package notifications
import (
"fmt"
"git.smsvc.net/pomodoro/ChronoTomato/internal/shared"
"github.com/fatih/color"
"strings"
)
func TerminalOutput() {
var modePrefix string
var timerOutput string
pomodoro := &shared.ServerMessage
fmt.Print("\033[H\033[2J") // Clears the screen
// header
color.Blue("Work: %d ◊ Break: %d ◊ Longbreak: %d\n\n",
pomodoro.PomodoroSettings.Work/60,
pomodoro.PomodoroSettings.ShortBreak/60,
pomodoro.PomodoroSettings.LongBreak/60,
)
//body
switch pomodoro.Mode {
case "Idle":
modePrefix = " "
timerOutput = ""
default:
modePrefix = " "
if pomodoro.Paused {
modePrefix = " "
} else {
}
minutes := pomodoro.TimeLeft / 60
seconds := pomodoro.TimeLeft % 60
timerOutput = fmt.Sprintf("⏳ %02d:%02d", minutes, seconds)
}
fmt.Printf("Session: %d/%d\n",
pomodoro.Session,
pomodoro.PomodoroSettings.Sessions,
)
fmt.Printf("%s %s\n", modePrefix, pomodoro.Mode)
fmt.Printf(timerOutput)
//footer
fmt.Printf(strings.Repeat("\n", 3))
color.White("space: start/pause/resume • s: stop • r: reset pomodoro • q: quit")
}