簡體   English   中英

存儲Clojure REPL行

[英]Store Clojure REPL lines

也許這是一個新問題,對不起如果是這樣!

是否可以將我輸入的所有行存儲在文件中的REPL中? 也許可以配置它來執行此操作或在關閉REPL會話之前執行此操作。

感謝您的回答!

Leiningen在項目中默認存儲歷史記錄:

$ lein new hello
$ cd hello
$ lein repl
user=> (+ 1 2 3)
user=> (exit)
$ cat .lein-repl-history

Boot始終默認存儲歷史記錄:

$ boot repl
boot.user=> (+ 1 2 3)
boot.user=> (exit)
$ cat .nrepl-history

您可以使用tee命令行實用程序。 請參閱以下內容:

$ lein repl | tee repl-output.txt
nREPL server started on port 52576 on host 127.0.0.1 - nrepl://127.0.0.1:52576
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_66-b17
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (+ 1 2)
3
user=> (println "Hello, world!")
Hello, world!
nil
user=> Bye for now!

之后:

$ cat repl-output.txt
nREPL server started on port 52576 on host 127.0.0.1 - nrepl://127.0.0.1:52576
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_66-b17
...
...

請注意,此類方法將捕獲所有REPL輸出以及您輸入的表單。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM