File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77package config
88
9+ import (
10+ _ "embed"
11+ )
12+
13+ //go:embed default.yml
14+ var defaultYml string
15+
916// Default returns the default configuration
1017func Default () string {
11- return `# Gaze configuration(priority: default < ~/.gaze.yml < ~/.config/gaze/gaze.yml < -f option)
12- commands:
13- - ext: .go
14- cmd: go run "{{file}}"
15- - ext: .py
16- cmd: python "{{file}}"
17- - ext: .rb
18- cmd: ruby "{{file}}"
19- - ext: .js
20- cmd: node "{{file}}"
21- - ext: .d
22- cmd: dmd -run "{{file}}"
23- - ext: .groovy
24- cmd: groovy "{{file}}"
25- - ext: .php
26- cmd: php "{{file}}"
27- - ext: .java
28- cmd: java "{{file}}"
29- - ext: .kts
30- cmd: kotlinc -script "{{file}}"
31- - ext: .rs
32- cmd: |
33- rustc "{{file}}" -o"{{base0}}.out"
34- ./"{{base0}}.out"
35- - ext: .cpp
36- cmd: |
37- gcc "{{file}}" -o"{{base0}}.out"
38- ./"{{base0}}.out"
39- - ext: .ts
40- cmd: |
41- tsc "{{file}}" --out "{{base0}}.out"
42- node ./"{{base0}}.out"
43- - ext: .zig
44- cmd: zig run "{{file}}"
45- - re: ^Dockerfile$
46- cmd: docker build -f "{{file}}" .
47-
48- log:
49- start: "[{{command}}]{{step}}"
50- end: "({{elapsed_ms}}ms)"`
18+ return defaultYml
5119}
Original file line number Diff line number Diff line change 1+ # Gaze configuration(priority: default < ~/.gaze.yml < ~/.config/gaze/gaze.yml < -f option)
2+ commands :
3+ - ext : .go
4+ cmd : go run "{{file}}"
5+ - ext : .py
6+ cmd : python "{{file}}"
7+ - ext : .rb
8+ cmd : ruby "{{file}}"
9+ - ext : .js
10+ cmd : node "{{file}}"
11+ - ext : .d
12+ cmd : dmd -run "{{file}}"
13+ - ext : .groovy
14+ cmd : groovy "{{file}}"
15+ - ext : .php
16+ cmd : php "{{file}}"
17+ - ext : .java
18+ cmd : java "{{file}}"
19+ - ext : .kts
20+ cmd : kotlinc -script "{{file}}"
21+ - ext : .rs
22+ cmd : |
23+ rustc "{{file}}" -o"{{base0}}.out"
24+ ./"{{base0}}.out"
25+ - ext : .cpp
26+ cmd : |
27+ gcc "{{file}}" -o"{{base0}}.out"
28+ ./"{{base0}}.out"
29+ - ext : .ts
30+ cmd : |
31+ tsc "{{file}}" --out "{{base0}}.out"
32+ node ./"{{base0}}.out"
33+ - ext : .zig
34+ cmd : zig run "{{file}}"
35+ - re : ^Dockerfile$
36+ cmd : docker build -f "{{file}}" .
37+
38+ log :
39+ start : " [{{command}}]{{step}}"
40+ end : " ({{elapsed_ms}}ms)"
Original file line number Diff line number Diff line change @@ -85,17 +85,19 @@ func executeCommand(cmd *exec.Cmd) CmdResult {
8585 cmd .Stderr = os .Stderr
8686
8787 start := time .Now ()
88- cmd .Start ()
88+ err := cmd .Start ()
89+ if err != nil {
90+ return CmdResult {StartTime : start , EndTime : time .Now (), Err : err }
91+ }
8992
9093 if cmd .Process != nil {
9194 logger .Info ("Pid: %d" , cmd .Process .Pid )
9295 } else {
9396 logger .Info ("Pid: ????" )
9497 }
95- err : = cmd .Wait ()
98+ err = cmd .Wait ()
9699
97- end := time .Now ()
98- return CmdResult {StartTime : start , EndTime : end , Err : err }
100+ return CmdResult {StartTime : start , EndTime : time .Now (), Err : err }
99101}
100102
101103func kill (cmd * exec.Cmd , reason string ) bool {
You can’t perform that action at this time.
0 commit comments