Genesis
This commit is contained in:
commit
11c599a371
11 changed files with 325 additions and 0 deletions
31
cmd/client/main.go
Normal file
31
cmd/client/main.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
"ChronoTomato/internal/websocket"
|
||||
)
|
||||
|
||||
var interrupt = make(chan os.Signal, 1)
|
||||
|
||||
func Start() {
|
||||
signal.Notify(interrupt, os.Interrupt)
|
||||
|
||||
GoTomatoUrl := flag.String("url", "ws://localhost:8080/ws", "GoTomato Server URL")
|
||||
password := flag.String("password", "", "Control password for pomodoro session (optional)")
|
||||
autoStart := flag.Bool("start", false, "Immediately start a Pomodoro")
|
||||
flag.Parse()
|
||||
|
||||
conn := websocket.Connect(*GoTomatoUrl)
|
||||
|
||||
websocket.Send_updateSettings(conn, *password)
|
||||
if *autoStart {
|
||||
websocket.SendCmd(conn, "start", *password)
|
||||
}
|
||||
|
||||
go websocket.ProcessServerMessages(conn)
|
||||
|
||||
websocket.WaitForDisconnect(conn, interrupt)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue