feat: add state icons for start/paused/stoppped

This commit is contained in:
Sebastian Mark 2024-10-24 19:16:57 +02:00
parent 4a772db0f8
commit 77eeb087e3

View file

@ -8,35 +8,42 @@ import (
) )
func TerminalOutput() { func TerminalOutput() {
var modePrefix string
var timerOutput string var timerOutput string
pomodoro := &shared.ServerMessage pomodoro := &shared.ServerMessage
fmt.Print("\033[H\033[2J") // Clears the screen fmt.Print("\033[H\033[2J") // Clears the screen
// header
color.Blue("Work: %d ◊ Break: %d ◊ Longbreak: %d\n\n", color.Blue("Work: %d ◊ Break: %d ◊ Longbreak: %d\n\n",
pomodoro.PomodoroSettings.Work/60, pomodoro.PomodoroSettings.Work/60,
pomodoro.PomodoroSettings.ShortBreak/60, pomodoro.PomodoroSettings.ShortBreak/60,
pomodoro.PomodoroSettings.LongBreak/60, pomodoro.PomodoroSettings.LongBreak/60,
) )
fmt.Printf("Session: %d/%d\n",
pomodoro.Session,
pomodoro.PomodoroSettings.Sessions,
)
fmt.Printf("▶ %s\n",
pomodoro.Mode,
)
//body
switch pomodoro.Mode { switch pomodoro.Mode {
case "Idle": case "Idle":
modePrefix = " "
timerOutput = "" timerOutput = ""
default: default:
modePrefix = " "
if pomodoro.Paused {
modePrefix = " "
} else {
}
minutes := pomodoro.TimeLeft / 60 minutes := pomodoro.TimeLeft / 60
seconds := pomodoro.TimeLeft % 60 seconds := pomodoro.TimeLeft % 60
timerOutput = fmt.Sprintf("⏳ %02d:%02d", minutes, seconds) 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) fmt.Printf(timerOutput)
//footer //footer