aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--golings/cmd/watch.go17
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()
+ }
+}