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:
parent
bb790459c1
commit
46d3e02f33
2 changed files with 9 additions and 7 deletions
|
@ -38,13 +38,9 @@ func Start() {
|
||||||
|
|
||||||
conn := websocket.Connect(url)
|
conn := websocket.Connect(url)
|
||||||
|
|
||||||
if config.PomodoroConfig != (models.GoTomatoPomodoroConfig{}) {
|
|
||||||
websocket.Send_updateSettings(conn, config.Password, config.PomodoroConfig)
|
|
||||||
}
|
|
||||||
|
|
||||||
go websocket.ProcessServerMessages(conn)
|
go websocket.ProcessServerMessages(conn)
|
||||||
pomodoro := &shared.ServerMessage
|
|
||||||
|
|
||||||
|
pomodoro := &shared.ServerMessage
|
||||||
keyboard.Listen(func(key keys.Key) (stop bool, err error) {
|
keyboard.Listen(func(key keys.Key) (stop bool, err error) {
|
||||||
switch key.String() {
|
switch key.String() {
|
||||||
case "space":
|
case "space":
|
||||||
|
@ -59,9 +55,15 @@ func Start() {
|
||||||
websocket.SendCmd(conn, password, "pause")
|
websocket.SendCmd(conn, password, "pause")
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
case "r":
|
case "s":
|
||||||
websocket.SendCmd(conn, password, "stop")
|
websocket.SendCmd(conn, password, "stop")
|
||||||
return false, nil
|
return false, nil
|
||||||
|
case "r":
|
||||||
|
|
||||||
|
if config.PomodoroConfig != (models.GoTomatoPomodoroConfig{}) {
|
||||||
|
websocket.Send_updateSettings(conn, password, config.PomodoroConfig)
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
case "q":
|
case "q":
|
||||||
interrupt <- os.Interrupt
|
interrupt <- os.Interrupt
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
|
@ -43,5 +43,5 @@ func TerminalOutput() {
|
||||||
|
|
||||||
//footer
|
//footer
|
||||||
fmt.Printf(strings.Repeat("\n", 3))
|
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")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue