-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
55 lines (51 loc) · 1.28 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
53
54
55
package main
import (
"log"
"os"
"github.com/anekkanti/go-codegen/pkg"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "go-generate-interface-impl",
Usage: "Generate implementations for interfaces",
Flags: []cli.Flag{
&cli.PathFlag{
Name: "input-directory",
Usage: "The input directory path containing the code to parse",
Aliases: []string{"i"},
Required: true,
},
&cli.StringSliceFlag{
Name: "names",
Usage: "The names to run the generator for",
Aliases: []string{"n"},
Required: true,
},
&cli.PathFlag{
Name: "renderer-plugin-path",
Usage: "The path to the renderer go plugin to load and use",
Aliases: []string{"r"},
Required: true,
},
&cli.PathFlag{
Name: "output-path",
Usage: "The output directory path to write the generated implementations to",
Aliases: []string{"o"},
Required: true,
},
},
Action: func(c *cli.Context) error {
in := &pkg.Input{
DirectoryPath: c.String("input-directory"),
PluginPath: c.String("renderer-plugin-path"),
OutputPath: c.String("output-path"),
NameFilters: c.StringSlice("names"),
}
return pkg.Generate(in)
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}