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:
James Shubin
2015-12-29 01:04:03 -05:00
parent 6b4fa21074
commit 1ba6be2957
5 changed files with 126 additions and 1 deletions

16
main.go
View File

@@ -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",