-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
50 lines (44 loc) · 1.25 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
package main
import (
"flag"
"io"
"log"
"os"
"github.com/shamaton/msgpackgen/internal/generator"
)
var (
inputDir = flag.String("input-dir", ".", "input directory. input-file cannot be used at the same time")
inputFile = flag.String("input-file", "", "input a specific file. input-dir cannot be used at the same time")
outputDir = flag.String("output-dir", ".", "output directory")
filename = flag.String("output-file", defaultFileName, "name of generated file")
pointer = flag.Int("pointer", defaultPointerLevel, "pointer level to consider")
useGopath = flag.Bool("use-gopath", false, "use GOPATH instead of go.mod")
dryRun = flag.Bool("dry-run", false, "dry run mode")
strict = flag.Bool("strict", false, "strict mode")
verbose = flag.Bool("v", false, "verbose diagnostics")
)
const (
defaultFileName = "resolver.msgpackgen.go"
defaultPointerLevel = 1
)
func main() {
flag.Parse()
err := generate(
*inputDir,
*inputFile,
*outputDir,
*filename,
*pointer,
*useGopath,
*dryRun,
*strict,
*verbose,
os.Stdout,
)
if err != nil {
log.Fatal(err)
}
}
func generate(iDir, iFile, oDir, oFile string, p int, ugo, dry, s, v bool, w io.Writer) error {
return generator.Run(iDir, iFile, oDir, oFile, p, ugo, dry, s, v, w)
}