Sebastian Mark
46d3e02f33
- change stop command from 'r' to 's' for better clarity
- add reset command 'r' to the terminal help
- ensure pomodoro settings are sent correctly on reset command
🤖
47 lines
978 B
Go
47 lines
978 B
Go
package notifications
|
|
|
|
import (
|
|
"ChronoTomato/internal/shared"
|
|
"atomicgo.dev/cursor"
|
|
"fmt"
|
|
"github.com/fatih/color"
|
|
"strings"
|
|
)
|
|
|
|
func TerminalOutput() {
|
|
var timerOutput string
|
|
|
|
pomodoro := &shared.ServerMessage
|
|
|
|
cursor.Hide()
|
|
fmt.Print("\033[H\033[2J") // Clears the screen
|
|
|
|
color.Blue("Work: %d ◊ Break: %d ◊ Longbreak: %d\n\n",
|
|
pomodoro.PomodoroSettings.Work/60,
|
|
pomodoro.PomodoroSettings.ShortBreak/60,
|
|
pomodoro.PomodoroSettings.LongBreak/60,
|
|
)
|
|
fmt.Printf("Session: %d/%d\n",
|
|
pomodoro.Session,
|
|
pomodoro.PomodoroSettings.Sessions,
|
|
)
|
|
fmt.Printf("▶ %s\n",
|
|
pomodoro.Mode,
|
|
)
|
|
|
|
switch pomodoro.Mode {
|
|
case "Idle":
|
|
timerOutput = ""
|
|
default:
|
|
minutes := pomodoro.TimeLeft / 60
|
|
seconds := pomodoro.TimeLeft % 60
|
|
|
|
timerOutput = fmt.Sprintf("⏳ %02d:%02d", minutes, seconds)
|
|
}
|
|
|
|
fmt.Printf(timerOutput)
|
|
|
|
//footer
|
|
fmt.Printf(strings.Repeat("\n", 3))
|
|
color.White("space: start/pause/resume • s: stop • r: reset pomodoro • q: quit")
|
|
}
|