feat: instroduce reset command

- 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

🤖
This commit is contained in:
Sebastian Mark 2024-10-23 17:42:33 +02:00
parent bb790459c1
commit 46d3e02f33
2 changed files with 9 additions and 7 deletions

View file

@ -38,13 +38,9 @@ func Start() {
conn := websocket.Connect(url)
if config.PomodoroConfig != (models.GoTomatoPomodoroConfig{}) {
websocket.Send_updateSettings(conn, config.Password, config.PomodoroConfig)
}
go websocket.ProcessServerMessages(conn)
pomodoro := &shared.ServerMessage
pomodoro := &shared.ServerMessage
keyboard.Listen(func(key keys.Key) (stop bool, err error) {
switch key.String() {
case "space":
@ -59,9 +55,15 @@ func Start() {
websocket.SendCmd(conn, password, "pause")
return false, nil
}
case "r":
case "s":
websocket.SendCmd(conn, password, "stop")
return false, nil
case "r":
if config.PomodoroConfig != (models.GoTomatoPomodoroConfig{}) {
websocket.Send_updateSettings(conn, password, config.PomodoroConfig)
}
return false, nil
case "q":
interrupt <- os.Interrupt
return true, nil

View file

@ -43,5 +43,5 @@ func TerminalOutput() {
//footer
fmt.Printf(strings.Repeat("\n", 3))
color.White("space: start/pause/resume • r: stop • q: quit")
color.White("space: start/pause/resume • s: stop • r: reset pomodoro • q: quit")
}