github.com/brycereitano/goa@v0.0.0-20170315073847-8ffa6c85e265/goagen/gen_main/options.go (about)

     1  package genmain
     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  //Target Name of generated "app" package
    30  func Target(target string) Option {
    31  	return func(g *Generator) {
    32  		g.Target = target
    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  }