I find it handy to save history to file, so here is how to do it in Ammonite.
importjava.io.BufferedWriter importjava.io.FileWriter valfile = new File("some-file.scala") valbw = new BufferedWriter(new FileWriter(file)) valhistory = repl.history.mkString("n") bw.write(history) bw.close()
Ammonite exposes a global object called
, which has a method called
. The code above converts history to a new line separated string and writes it to file.