From 46d3e02f335e35faae18bba16694e7314687c6cb Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Wed, 23 Oct 2024 17:42:33 +0200 Subject: [PATCH] feat: instroduce reset command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 🤖 --- cmd/client/main.go | 14 ++++++++------ internal/notifications/terminal.go | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd/client/main.go b/cmd/client/main.go index 9184598..63da593 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -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 diff --git a/internal/notifications/terminal.go b/internal/notifications/terminal.go index 3731435..685cf79 100644 --- a/internal/notifications/terminal.go +++ b/internal/notifications/terminal.go @@ -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") }