Grab scala REPL History (from sbt console)

Is it possible to get a history list of all the latest commands introduced in scala repl? (run repl inside sbt console if that matters). :history , followed by the number of commands to return to work, but it would be nice to export them to a text file that can be processed in the scala source file.

+7
scala
source share
2 answers

Scala 2.11+ has new REPL commands to save output. Look here: How to save a REPL session?

In earlier versions you can get REPL history: less ~/.scala_history

+6
source share

This is a simple trick:

  scala> def history = scala.io.Source.fromFile(System.getProperty("user.home") + "/.scala_history").foreach(print) scala> history 
+3
source share

All Articles