Add graphviz generation and visualization
This requires graphviz to be installed on your machine. If you run the command with sudo, it will create the files with the original user ownership to make it easier to remove them without root.
This commit is contained in:
16
main.go
16
main.go
@@ -102,6 +102,12 @@ func run(c *cli.Context) {
|
||||
log.Fatal("Graph failure")
|
||||
}
|
||||
log.Printf("Graph: %v\n", G) // show graph
|
||||
err := G.ExecGraphviz(c.String("graphviz-filter"), c.String("graphviz"))
|
||||
if err != nil {
|
||||
log.Printf("Graphviz: %v", err)
|
||||
} else {
|
||||
log.Printf("Graphviz: Successfully generated graph!")
|
||||
}
|
||||
G.SetVertex()
|
||||
if first {
|
||||
// G.Start(...) needs to be synchronous or wait,
|
||||
@@ -174,6 +180,16 @@ func main() {
|
||||
Value: "",
|
||||
Usage: "code definition to run",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "graphviz, g",
|
||||
Value: "",
|
||||
Usage: "output file for graphviz data",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "graphviz-filter, gf",
|
||||
Value: "dot", // directed graph default
|
||||
Usage: "graphviz filter to use",
|
||||
},
|
||||
// useful for testing multiple instances on same machine
|
||||
cli.StringFlag{
|
||||
Name: "hostname",
|
||||
|
||||
Reference in New Issue
Block a user