-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.go
44 lines (33 loc) · 718 Bytes
/
generate.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
package main
import (
"os"
"strings"
)
func (p *Plugin) generateArgs() []string {
args := []string{"-Q", "woodpecker"}
if path, err := os.Getwd(); err == nil {
args = append(args, "--rootDir", path)
}
if p.Name != "" {
args = append(args, "--name", p.Name)
}
if len(p.Flags) != 0 {
args = append(args, "--flags", strings.Join(p.Flags, ","))
}
if len(p.Env) != 0 {
args = append(args, "--env", strings.Join(p.Env, ","))
}
if p.DryRun {
args = append(args, "--dryRun")
}
if p.Required {
args = append(args, "--nonZero")
}
for _, file := range p.Files {
args = append(args, "--file", file)
}
for _, path := range p.Paths {
args = append(args, "--dir", path)
}
return args
}