From a726e83ca6c86e899fdd71c75bc50d39d8dcc609 Mon Sep 17 00:00:00 2001 From: Elis Hirwing Date: Sat, 4 Nov 2017 22:02:12 +0100 Subject: [PATCH] Print all modules data in a loop to the terminal --- statusscreen.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/statusscreen.go b/statusscreen.go index dd1faa6..439832a 100644 --- a/statusscreen.go +++ b/statusscreen.go @@ -3,6 +3,7 @@ package main import ( "fmt" "github.com/BurntSushi/toml" + tm "github.com/buger/goterm" "io/ioutil" "os" "statusscreen" @@ -16,17 +17,29 @@ func main() { clock := statusscreen.Clock{Config: &config} weather := statusscreen.Weather{Config: &config} + tm.Clear() + for { + tm.MoveCursor(1, 1) + for _, row := range clock.GetOutput() { - fmt.Println(row) + tm.Print(row + "\033[K\n") } + + tm.Print("\033[K\n") + for _, row := range weather.GetOutput() { - fmt.Println(row) + tm.Print(row + "\033[K\n") } + + tm.Print("\033[K\n") + for _, row := range sl.GetOutput() { - fmt.Println(row) + tm.Print(row + "\033[K\n") } + tm.Flush() + time.Sleep(1 * time.Second) } }