Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds constructor method and defines options for all the generators (#…
- Loading branch information
Showing
16 changed files
with
443 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package genclient | ||
|
||
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 | ||
} | ||
} | ||
|
||
//Target Name of generated package | ||
func Target(target string) Option { | ||
return func(g *Generator) { | ||
g.Target = target | ||
} | ||
} | ||
|
||
//ToolDirName Name of tool directory where CLI main is generated once | ||
func ToolDirName(toolDirName string) Option { | ||
return func(g *Generator) { | ||
g.ToolDirName = toolDirName | ||
} | ||
} | ||
|
||
//Tool Name of CLI tool | ||
func Tool(tool string) Option { | ||
return func(g *Generator) { | ||
g.Tool = tool | ||
} | ||
} | ||
|
||
//NoTool Whether to skip tool generation | ||
func NoTool(noTool bool) Option { | ||
return func(g *Generator) { | ||
g.NoTool = noTool | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package genjs | ||
|
||
import "github.com/goadesign/goa/design" | ||
import "time" | ||
|
||
//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 | ||
} | ||
} | ||
|
||
//Timeout Timeout used by JavaScript client when making requests | ||
func Timeout(timeout time.Duration) Option { | ||
return func(g *Generator) { | ||
g.Timeout = timeout | ||
} | ||
} | ||
|
||
//Scheme Scheme used by JavaScript client | ||
func Scheme(scheme string) Option { | ||
return func(g *Generator) { | ||
g.Scheme = scheme | ||
} | ||
} | ||
|
||
//Host addressed by JavaScript client | ||
func Host(host string) Option { | ||
return func(g *Generator) { | ||
g.Host = host | ||
} | ||
} | ||
|
||
//NoExample Do not generate an HTML example file | ||
func NoExample(noExample bool) Option { | ||
return func(g *Generator) { | ||
g.NoExample = noExample | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.