diff --git a/core/core.go b/core/core.go index 9f17840..649509f 100644 --- a/core/core.go +++ b/core/core.go @@ -35,6 +35,7 @@ func WatchForChanges(fileName string, executor func(string)) { logger.LError("failed to watch for changes: " + err.Error()) } + i := 0 for { stat, err := os.Stat(fileName) if err != nil { @@ -44,11 +45,13 @@ func WatchForChanges(fileName string, executor func(string)) { if stat.Size() != initialStat.Size() || stat.ModTime() != stat.ModTime() { initialStat = stat - logger.LInfo("detected change, recompiling...") + i++ + fmt.Print(logger.ANSI_CLEAR) + logger.LInfo("detected change, recompiling... (" + fmt.Sprint(i) + ")") executor(fileName) } - time.Sleep(1 * time.Second) + time.Sleep(100 * time.Millisecond) } } diff --git a/logger/logger.go b/logger/logger.go index d2728f9..1db4123 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -7,6 +7,7 @@ import ( const ( ANSI_RESET = "\033[0m" + ANSI_CLEAR = "\033c" ANSI_RED = "\033[91m" ANSI_YELLOW = "\033[93m" ANSI_BLUE = "\033[94m"