File tree 2 files changed +20
-7
lines changed
2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,14 @@ const (
21
21
)
22
22
23
23
type 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"`
31
32
}
32
33
33
34
type cfgBuild struct {
@@ -79,6 +80,10 @@ type cfgMisc struct {
79
80
CleanOnExit bool `toml:"clean_on_exit"`
80
81
}
81
82
83
+ type cfgScreen struct {
84
+ ClearOnRebuild bool `toml:"clear_on_rebuild"`
85
+ }
86
+
82
87
func initConfig (path string ) (cfg * config , err error ) {
83
88
if path == "" {
84
89
cfg , err = defaultPathConfig ()
Original file line number Diff line number Diff line change 1
1
package runner
2
2
3
3
import (
4
+ "fmt"
4
5
"io"
5
6
"os"
6
7
"os/exec"
@@ -319,17 +320,24 @@ func (e *Engine) start() {
319
320
continue
320
321
}
321
322
}
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
+ }
322
327
e .mainLog ("%s has changed" , e .config .rel (filename ))
323
328
case <- firstRunCh :
324
329
// go down
325
330
break
326
331
}
327
332
333
+ // already build and run now
328
334
select {
329
335
case <- e .buildRunCh :
330
336
e .buildRunStopCh <- true
331
337
default :
332
338
}
339
+
340
+ // if current app is running, stop it
333
341
e .withLock (func () {
334
342
if e .binRunning {
335
343
e .binStopCh <- true
You can’t perform that action at this time.
0 commit comments