Leiningen 是否将 repl-options 传递给 clojure。main/repl
Does Leiningen pass repl-options to clojure.main/repl
常规的 Clojure repl clojure.main/repl
接受 :print
、:prompt
和 :eval
等选项,让您可以挂接并覆盖 repl 的行为。
例如
(clojure.main/repl
:print #(println "main print!" %)
:prompt #(println "main prompt!")
:eval #(do (println "main eval!") (eval %)))
我假设 Leiningen 的 :repl-options
让您指定相同的选项,Leiningen 会将它们传递给 Clojure 的 repl。 Leiningen repo 中甚至对此有所暗示:
Support :repl-options in project.clj that get passed to
clojure.main/repl.
我无法让它工作。 Leiningen 似乎不接受与 clojure.main/repl
相同的选项集。 :prompt
有效,尽管函数签名不同,:print
和 :eval
似乎被忽略了。
有没有办法改变 Leiningen 的 repl 中的 print 和 eval 行为?
我的project.clj
:
(defproject repl-test "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.7.0"]]
:repl-options {
:print #(println "lein print!" %)
:prompt (constantly "lein prompt!")
:eval #(do (println "lein eval!") (eval %))
}
)
我正在使用 Leiningen 2.7.1。
背景:
我一直在尝试将 lein repl
设置为使用 pprint
作为其输出。同样,NEWS.md 暗示了这一点:
Support :project-init in project.clj to allow pprint to be used in
:repl-options.
帮助也很感激!
lein repl
启动 nREPL,而不是 clojure.main/repl
。它支持一组不同的选项。检查样本 project.clj
是否有 list of supported parameters.
常规的 Clojure repl clojure.main/repl
接受 :print
、:prompt
和 :eval
等选项,让您可以挂接并覆盖 repl 的行为。
例如
(clojure.main/repl
:print #(println "main print!" %)
:prompt #(println "main prompt!")
:eval #(do (println "main eval!") (eval %)))
我假设 Leiningen 的 :repl-options
让您指定相同的选项,Leiningen 会将它们传递给 Clojure 的 repl。 Leiningen repo 中甚至对此有所暗示:
Support :repl-options in project.clj that get passed to clojure.main/repl.
我无法让它工作。 Leiningen 似乎不接受与 clojure.main/repl
相同的选项集。 :prompt
有效,尽管函数签名不同,:print
和 :eval
似乎被忽略了。
有没有办法改变 Leiningen 的 repl 中的 print 和 eval 行为?
我的project.clj
:
(defproject repl-test "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.7.0"]]
:repl-options {
:print #(println "lein print!" %)
:prompt (constantly "lein prompt!")
:eval #(do (println "lein eval!") (eval %))
}
)
我正在使用 Leiningen 2.7.1。
背景:
我一直在尝试将 lein repl
设置为使用 pprint
作为其输出。同样,NEWS.md 暗示了这一点:
Support :project-init in project.clj to allow pprint to be used in :repl-options.
帮助也很感激!
lein repl
启动 nREPL,而不是 clojure.main/repl
。它支持一组不同的选项。检查样本 project.clj
是否有 list of supported parameters.