forked from davyxu/tabtoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entry_v2.go
73 lines (57 loc) · 1.35 KB
/
entry_v2.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package main
import (
"flag"
"github.com/davyxu/tabtoy/v2"
"github.com/davyxu/tabtoy/v2/i18n"
"github.com/davyxu/tabtoy/v2/printer"
"os"
)
func V2Entry() {
g := printer.NewGlobals()
if *paramLanguage != "" {
if !i18n.SetLanguage(*paramLanguage) {
log.Infof("language not support: %s", *paramLanguage)
}
}
g.Version = Version_v2
for _, v := range flag.Args() {
g.InputFileList = append(g.InputFileList, v)
}
g.ParaMode = *paramPara
g.CombineStructName = *paramCombineStructName
g.ProtoVersion = *paramProtoVersion
g.LuaEnumIntValue = *paramLuaEnumIntValue
g.LuaTabHeader = *paramLuaTabHeader
g.GenCSSerailizeCode = *paramGenCSharpBinarySerializeCode
g.PackageName = *paramPackageName
if *paramProtoOut != "" {
g.AddOutputType("proto", *paramProtoOut)
}
if *paramPbtOut != "" {
g.AddOutputType("pbt", *paramPbtOut)
}
if *paramJsonOut != "" {
g.AddOutputType("json", *paramJsonOut)
}
if *paramLuaOut != "" {
g.AddOutputType("lua", *paramLuaOut)
}
if *paramCSharpOut != "" {
g.AddOutputType("cs", *paramCSharpOut)
}
if *paramGoOut != "" {
g.AddOutputType("go", *paramGoOut)
}
if *paramCppOut != "" {
g.AddOutputType("cpp", *paramCppOut)
}
if *paramBinaryOut != "" {
g.AddOutputType("bin", *paramBinaryOut)
}
if *paramTypeOut != "" {
g.AddOutputType("type", *paramTypeOut)
}
if !v2.Run(g) {
os.Exit(1)
}
}