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

     1  package genclient
     2  
     3  import (
     4  	"github.com/goadesign/goa/design"
     5  )
     6  
     7  //Option a generator option definition
     8  type Option func(*Generator)
     9  
    10  //API The API definition
    11  func API(API *design.APIDefinition) Option {
    12  	return func(g *Generator) {
    13  		g.API = API
    14  	}
    15  }
    16  
    17  //OutDir Path to output directory
    18  func OutDir(outDir string) Option {
    19  	return func(g *Generator) {
    20  		g.OutDir = outDir
    21  	}
    22  }
    23  
    24  //Target Name of generated package
    25  func Target(target string) Option {
    26  	return func(g *Generator) {
    27  		g.Target = target
    28  	}
    29  }
    30  
    31  //ToolDirName Name of tool directory where CLI main is generated once
    32  func ToolDirName(toolDirName string) Option {
    33  	return func(g *Generator) {
    34  		g.ToolDirName = toolDirName
    35  	}
    36  }
    37  
    38  //Tool Name of CLI tool
    39  func Tool(tool string) Option {
    40  	return func(g *Generator) {
    41  		g.Tool = tool
    42  	}
    43  }
    44  
    45  //NoTool Whether to skip tool generation
    46  func NoTool(noTool bool) Option {
    47  	return func(g *Generator) {
    48  		g.NoTool = noTool
    49  	}
    50  }