我想更改Scala REPL的提示符。我发现我可以像下面这样改变电源模式下的提示符。
scala>
scala> :power
** Power User mode enabled - BEEP WHIR GYVE **
** :phase has been set to 'typer'. **
** scala.tools.nsc._ has been imported **
** global._, definitions._ also imported **
** Try :help, :vals, power.<tab> **
scala> repl.setPrompt("ncool prompt!> ")
cool prompt!>
现在我想在正常模式或sbt控制台的initialCommands
中执行此操作。有人知道怎么做吗?
Scala 2.10.0
$intp.asInstanceOf[scala.tools.nsc.interpreter.ILoop$ILoopInterpreter]
.getClass
.getDeclaredField("$outer").get($intp)
.asInstanceOf[scala.tools.nsc.interpreter.ILoop]
.setPrompt("ncool prompt!> ")