github.com/brycereitano/goa@v0.0.0-20170315073847-8ffa6c85e265/goagen/gen_controller/options.go (about) 1 package gencontroller 2 3 import "github.com/goadesign/goa/design" 4 5 //Option a generator option definition 6 type Option func(*Generator) 7 8 //API The API definition 9 func API(API *design.APIDefinition) Option { 10 return func(g *Generator) { 11 g.API = API 12 } 13 } 14 15 //OutDir Path to output directory 16 func OutDir(outDir string) Option { 17 return func(g *Generator) { 18 g.OutDir = outDir 19 } 20 } 21 22 //DesignPkg Path to design package, only used to mark generated files. 23 func DesignPkg(designPkg string) Option { 24 return func(g *Generator) { 25 g.DesignPkg = designPkg 26 } 27 } 28 29 //AppPkg Name of generated "app" package 30 func AppPkg(pkg string) Option { 31 return func(g *Generator) { 32 g.AppPkg = pkg 33 } 34 } 35 36 //Force Whether to override existing files 37 func Force(force bool) Option { 38 return func(g *Generator) { 39 g.Force = force 40 } 41 } 42 43 //Pkg sets the name of generated package 44 func Pkg(name string) Option { 45 return func(g *Generator) { 46 g.Pkg = name 47 } 48 } 49 50 //Resource Name of generated the generated file 51 func Resource(res string) Option { 52 return func(g *Generator) { 53 g.Resource = res 54 } 55 }