-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
36 lines (28 loc) · 773 Bytes
/
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
/*
This package helps understand a Ren'Py source code by drawing a graph from the source code
*/
package main
import (
"fmt"
"github.com/skratchdot/open-golang/open"
"pkg.amethysts.studio/renpy-graphviz/parser"
)
func main() {
path, options := PlugCLI()
content := parser.GetRenpyContent(path)
graph, err := parser.Graph(content, options)
if err != nil {
parser.DocumentIssue(err)
}
err = graph.CreateFile("renpy-graphviz.dot")
if err != nil {
parser.DocumentIssue(err)
}
readDotFileToDrawGraph("renpy-graphviz.dot", "renpy-graphviz.png")
if graph.Options.OpenFile {
err = open.Run("renpy-graphviz.png")
if err != nil {
fmt.Println("A renpy-graphviz.png image file has been created, but couldn't be open. Please open it manually.")
}
}
}