From deff8f35548dec400c860e806426efbc7e14b7ce Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Wed, 23 Oct 2024 18:15:26 +0200 Subject: [PATCH] feat: move `cursor.Hide()` to `main` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - hide cursor at the start of the client - ensure cursor is shown again after client execution 🤖 --- cmd/client/main.go | 4 ++++ internal/notifications/terminal.go | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/client/main.go b/cmd/client/main.go index 3ca3118..458c035 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -1,6 +1,7 @@ package client import ( + "atomicgo.dev/cursor" "flag" "os" "os/signal" @@ -19,6 +20,9 @@ var interrupt = make(chan os.Signal, 1) func Start() { signal.Notify(interrupt, os.Interrupt) + cursor.Hide() + defer cursor.Show() + parameter_url := flag.String("url", "", "GoTomato Server URL (eg ws://localhost:8080/ws)") parameter_password := flag.String("password", "", "Control password for pomodoro session (optional)") configfile := flag.String("config", "~/.config/ChronoTomato.yml", "path to config file (optional)") diff --git a/internal/notifications/terminal.go b/internal/notifications/terminal.go index f7915e9..03fb15a 100644 --- a/internal/notifications/terminal.go +++ b/internal/notifications/terminal.go @@ -1,9 +1,8 @@ package notifications import ( - "git.smsvc.net/pomodoro/ChronoTomato/internal/shared" - "atomicgo.dev/cursor" "fmt" + "git.smsvc.net/pomodoro/ChronoTomato/internal/shared" "github.com/fatih/color" "strings" ) @@ -13,7 +12,6 @@ func TerminalOutput() { pomodoro := &shared.ServerMessage - cursor.Hide() fmt.Print("\033[H\033[2J") // Clears the screen color.Blue("Work: %d ◊ Break: %d ◊ Longbreak: %d\n\n",