Save Ammonite (Scala REPL) History to File

I use Ammonite
and ipython
like REPL for Scala.

I find it handy to save history to file, so here is how to do it in Ammonite.
valfile = new File("some-file.scala")
valbw = new BufferedWriter(new FileWriter(file))
valhistory = 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 ��

Alex Kras稿源:Alex Kras (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » Save Ammonite (Scala REPL) History to File

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录