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.
Asked
Active
Viewed 247 times
1

Łukasz Biały
- 431
- 5
- 14
1 Answers
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
-
1Thanks, sadly entries are not broken into sessions, but that's fine anyway! – Łukasz Biały Jan 02 '20 at 13:07