/
options.go
48 lines (40 loc) Β· 989 Bytes
/
options.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
47
48
package genmain
import "github.com/goadesign/goa/design"
//Option a generator option definition
type Option func(*Generator)
//API The API definition
func API(API *design.APIDefinition) Option {
return func(g *Generator) {
g.API = API
}
}
//OutDir Path to output directory
func OutDir(outDir string) Option {
return func(g *Generator) {
g.OutDir = outDir
}
}
//DesignPkg Path to design package, only used to mark generated files.
func DesignPkg(designPkg string) Option {
return func(g *Generator) {
g.DesignPkg = designPkg
}
}
//Target Name of generated "app" package
func Target(target string) Option {
return func(g *Generator) {
g.Target = target
}
}
//Force Whether to override existing files
func Force(force bool) Option {
return func(g *Generator) {
g.Force = force
}
}
//Regen Whether to regenerate scaffolding in place, maintaining existing controller implementation
func Regen(regen bool) Option {
return func(g *Generator) {
g.Regen = regen
}
}