-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.go
46 lines (38 loc) · 982 Bytes
/
settings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package exe
import "time"
// SettingsFunc is a function which modifies the execution setting.
type SettingsFunc func(s *ExecuteSetting)
// ExecuteSetting holds options to apply to a command runner.
type ExecuteSetting struct {
dir string
start bool
output bool
timeout time.Duration
//executeAstemplate bool
}
// WithStart sets the command to run async.
func WithStart(s *ExecuteSetting) {
s.start = true
}
// WithDir sets working directory to use when running the command.
func WithDir(path string) SettingsFunc {
return func(s *ExecuteSetting) {
s.dir = path
}
}
// withOutput makes the command run with output.
func withOutput(s *ExecuteSetting) {
s.output = true
}
// WithTimeout sets a maximum duration to wait.
func WithTimeout(duration time.Duration) SettingsFunc {
return func(s *ExecuteSetting) {
s.timeout = duration
}
}
/*
// WithoutTemplateExecution does
func WithoutTemplateExecution(s *ExecuteSetting) {
s.executeAstemplate = false
}
*/