Skip to content

Instantly share code, notes, and snippets.

@Octogonapus
Last active March 9, 2019 01:37
Show Gist options
  • Save Octogonapus/b0d62e6fdc06d8d9fd18a6e638b88bf6 to your computer and use it in GitHub Desktop.
Save Octogonapus/b0d62e6fdc06d8d9fd18a6e638b88bf6 to your computer and use it in GitHub Desktop.
Writes a Guice injector graph to a .dot file
import arrow.core.Either
import arrow.core.right
import com.google.common.collect.ImmutableList
import com.neuronrobotics.bowlerbuilder.view.cad.cadengine.util.GuiceGrapher
import com.neuronrobotics.bowlerkernel.hardware.Script
class WriteGuiceGraphScript : Script() {
override fun runScript(args: ImmutableList<Any?>): Either<String, Any?> {
val filename = if (args.size == 1 && args.first() is String)
args.first() as String
else
"guice-graph.dot"
GuiceGrapher.graph(filename, injector)
return Unit.right()
}
override fun stopScript() { }
}
WriteGuiceGraphScript::class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment