Is it possible to get a history listing of all recent commands entered on the scala repl? (running the repl inside sbt console
if it matters). :history
followed by the number of commands back to show works, but it would be nice being able to export this to a text file that can be worked into a scala source file.
We can start Scala REPL by typing scala command in console/terminal.
The Scala REPL is a tool (scala) for evaluating expressions in Scala. The scala command will execute a source script by wrapping it in a template and then compiling and executing the resulting program.
To run your program, type run . To leave sbt shell, type exit or use Ctrl+D (Unix) or Ctrl+Z (Windows).
To run Scala from the command-line, download the binaries and unpack the archive. Start the Scala interpreter (aka the “REPL”) by launching scala from where it was unarchived. Start the Scala compiler by launching scalac from where it was unarchived.
This is a simple trick:
scala> def history = scala.io.Source.fromFile(System.getProperty("user.home") + "/.scala_history").foreach(print)
scala> history
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