是否可以以编程方式更改Scala REPL的提示?

tot*_*shi 9 scala read-eval-print-loop

我想更改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!> 
Run Code Online (Sandbox Code Playgroud)

现在我想在正常模式或initialCommandssbt控制台中执行此操作.有谁知道如何做到这一点?

Ken*_*ida 8

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!> ")
Run Code Online (Sandbox Code Playgroud)