When running with sbt console
:
I created a %USERPROFILE%\.sbt\0.13\global.sbt
global configuration file and added the start code to it:
initialCommands in console := """
def viewdoc[A](a: A) {
val name = a.asInstanceOf[AnyRef].getClass.getName
val url = "http://www.scala-lang.org/api/current/index.html#"+name
val pb = new ProcessBuilder("firefox",url)
val p = pb.start
p.waitFor
}
"""
Running sbt console:
C:\WINDOWS>sbt console
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Set current project to windows (in build file:/C:/Windows/)
[info] Starting scala interpreter...
[info]
viewdoc: [A](a: A)Unit
Welcome to Scala version 2.10.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_74).
Type in expressions to have them evaluated.
Type :help for more information.
When running with scala
:
See question here: Call another program with arguments passed to the currently executing batch file