dorfylegends/analyze/analyze.go

44 lines
670 B
Go
Raw Normal View History

2022-04-14 16:58:28 +03:00
package main
2022-04-13 08:28:07 +03:00
import (
2022-04-14 17:06:17 +03:00
"flag"
2022-04-15 16:27:51 +03:00
"log"
2022-04-13 08:28:07 +03:00
2022-04-14 18:39:18 +03:00
"github.com/robertjanetzko/LegendsBrowser2/analyze/df"
2022-04-13 08:28:07 +03:00
)
2022-04-14 17:06:17 +03:00
func main() {
a := flag.String("a", "", "analyze a file")
g := flag.Bool("g", false, "generate model")
2022-04-18 18:26:14 +03:00
e := flag.Bool("e", false, "regenerate events")
2022-04-14 17:06:17 +03:00
flag.Parse()
if len(*a) > 0 {
2022-04-14 20:06:52 +03:00
df.AnalyzeStructure(*a)
2022-04-14 17:06:17 +03:00
}
if *g {
2022-04-18 18:26:14 +03:00
a, err := df.LoadAnalyzeData()
2022-04-15 16:27:51 +03:00
if err != nil {
log.Fatal(err)
}
2022-04-18 18:26:14 +03:00
df.ListEnumCandidates(a)
m, err := df.CreateMetadata(a)
if err != nil {
log.Fatal(err)
}
if err := df.GenerateBackendCode(m); err != nil {
log.Fatal(err)
}
if *e {
if err := df.GenerateEventsCode(m); err != nil {
log.Fatal(err)
}
}
2022-04-14 17:06:17 +03:00
}
}