I find it handy to save history to file, so here is how to do it in Ammonite.
val file = new File("some-file.scala")
val bw = new BufferedWriter(new FileWriter(file))
val history = repl.history.mkString("\n")
Ammonite exposes a global object called
repl, which has a method called
history. The code above converts history to a new line separated string and writes it to file.
Enjoy 🙂Please Share: