-
Notifications
You must be signed in to change notification settings - Fork 151
/
main.go
52 lines (46 loc) · 1.23 KB
/
main.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
49
50
51
52
package main
import (
"github.com/fern-api/fern-go/internal/cmd"
"github.com/fern-api/fern-go/internal/coordinator"
"github.com/fern-api/fern-go/internal/generator"
"github.com/fern-api/fern-go/internal/writer"
)
const usage = `Generate Go clients from your Fern API definition.
Usage:
fern-go-sdk <config_file_path>
Flags:
-h, --help Print this help and exit.
-v, --version Print the version and exit.`
func main() {
cmd.Run(usage, run)
}
func run(config *cmd.Config, coordinator *coordinator.Client) ([]*generator.File, error) {
_, includeReadme := config.Writer.Mode.(*writer.GithubConfig)
generatorConfig, err := generator.NewConfig(
config.DryRun,
config.EnableExplicitNull,
config.IncludeLegacyClientOptions,
includeReadme,
config.Whitelabel,
config.AlwaysSendRequiredProperties,
config.InlinePathParameters,
config.InlineFileProperties,
config.Organization,
config.Version,
config.IrFilepath,
config.SnippetFilepath,
config.ImportPath,
config.PackageName,
config.ExportedClientName,
config.UnionVersion,
config.Module,
)
if err != nil {
return nil, err
}
g, err := generator.New(generatorConfig, coordinator)
if err != nil {
return nil, err
}
return g.Generate(generator.ModeClient)
}