File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed
Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,14 @@ const (
2121)
2222
2323type config struct {
24- Root string `toml:"root"`
25- TmpDir string `toml:"tmp_dir"`
26- TestDataDir string `toml:"testdata_dir"`
27- Build cfgBuild `toml:"build"`
28- Color cfgColor `toml:"color"`
29- Log cfgLog `toml:"log"`
30- Misc cfgMisc `toml:"misc"`
24+ Root string `toml:"root"`
25+ TmpDir string `toml:"tmp_dir"`
26+ TestDataDir string `toml:"testdata_dir"`
27+ Build cfgBuild `toml:"build"`
28+ Color cfgColor `toml:"color"`
29+ Log cfgLog `toml:"log"`
30+ Misc cfgMisc `toml:"misc"`
31+ Screen cfgScreen `toml:"screen"`
3132}
3233
3334type cfgBuild struct {
@@ -79,6 +80,10 @@ type cfgMisc struct {
7980 CleanOnExit bool `toml:"clean_on_exit"`
8081}
8182
83+ type cfgScreen struct {
84+ ClearOnRebuild bool `toml:"clear_on_rebuild"`
85+ }
86+
8287func initConfig (path string ) (cfg * config , err error ) {
8388 if path == "" {
8489 cfg , err = defaultPathConfig ()
Original file line number Diff line number Diff line change 11package runner
22
33import (
4+ "fmt"
45 "io"
56 "os"
67 "os/exec"
@@ -319,17 +320,24 @@ func (e *Engine) start() {
319320 continue
320321 }
321322 }
323+ // clean on rebuild https://stackoverflow.com/questions/22891644/how-can-i-clear-the-terminal-screen-in-go
324+ if e .config .Screen .ClearOnRebuild {
325+ fmt .Println ("\033 [2J" )
326+ }
322327 e .mainLog ("%s has changed" , e .config .rel (filename ))
323328 case <- firstRunCh :
324329 // go down
325330 break
326331 }
327332
333+ // already build and run now
328334 select {
329335 case <- e .buildRunCh :
330336 e .buildRunStopCh <- true
331337 default :
332338 }
339+
340+ // if current app is running, stop it
333341 e .withLock (func () {
334342 if e .binRunning {
335343 e .binStopCh <- true
You can’t perform that action at this time.
0 commit comments