I am trying to dynamically interpret a string as a command in Scala. For this, from what I understand, I need to call intp.interpret("string") (where intp stands for the current interpreter and string for my command) while being in power mode, right? 
However, my problem is that I want to do that from inside a script. Thus, I am looking for a way to switch to power user mode from inside a script, and then call intp.interpret.
Is there any way to do this switching from inside a script file?
If you're invoking the REPL from a bash script or somesuch then you can enable :power mode immediately via the scala.repl.power system property,
miles@lewis$ scala -Dscala.repl.power
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_05)
Type in expressions to have them evaluated.
Type :help for more information.
scala>
[info] compiler init time: 2.186 s.
scala>
** Power User mode enabled - BEEP BOOP SPIZ **
** :phase has been set to 'typer'.          **
** scala.tools.nsc._ has been imported      **
** global._ and definitions._ also imported **
** Try  :help,  vals.<tab>,  power.<tab>    **
scala> 
[info] total init time: 5.105 s.
scala>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With