1

What is the best way to print history of code executed in ammonite repl in previous sessions? I am aware of repl.history but it contains code from current session and I know that ammonite keeps history of previous sessions because snippets from them are available using "up arrow" key.

Łukasz Biały
  • 431
  • 5
  • 14

1 Answers1

3

On Linux or Mac history is stored in your home directory in file ~/.ammonite/history, so you could maybe just load it from file:

import scala.util.Using
import scala.io.Source

val history = Using(Source.fromFile("/path/to/home/.ammonite/history"))(_.getLines)
Krzysztof Atłasik
  • 21,985
  • 6
  • 54
  • 76