diff options
author | lalizita <laislima98@hotmail.com> | 2023-03-30 10:57:30 -0300 |
---|---|---|
committer | lalizita <laislima98@hotmail.com> | 2023-03-30 10:57:30 -0300 |
commit | 4d556cc670c45e7714719209c1f0dd12a45a6009 (patch) | |
tree | ffbf09d0704906855f27407a8283cfb9437a1526 /golings | |
parent | df9ff2a05db350adafaf2617102fc65c6861b762 (diff) |
Add clear command
Diffstat (limited to 'golings')
-rw-r--r-- | golings/cmd/watch.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/golings/cmd/watch.go b/golings/cmd/watch.go index e9986b5..00f77f7 100644 --- a/golings/cmd/watch.go +++ b/golings/cmd/watch.go @@ -6,7 +6,9 @@ import ( "io/fs" "log" "os" + "os/exec" "path/filepath" + "runtime" "strings" "github.com/fatih/color" @@ -114,6 +116,7 @@ func WatchEvents(updateF chan<- string) { } func RunNextExercise(infoFile string) { + CallClear() exercise, err := exercises.NextPending(infoFile) if err != nil { color.Red("Failed to find next exercises") @@ -136,3 +139,17 @@ func RunNextExercise(infoFile string) { } } } + +func CallClear() { + if runtime.GOOS == "windows" { + fmt.Println("===========CLEARIIIIIING windows") + cmd := exec.Command("cmd", "/c", "cls") + cmd.Stdout = os.Stdout + cmd.Run() + } else { + fmt.Println("===========CLEARIIIIIING LINUX") + cmd := exec.Command("clear") //Linux example, its tested + cmd.Stdout = os.Stdout + cmd.Run() + } +} |