Hello everyone 🙂 I wonder if it was possible when using the cli command to evaluate code in the nrepl server? I would like to run the djblue/portal commands on start.
Not sure, I don't think so, but one option would be to do something like this:
λ cat deps.edn
{:deps {nrepl/nrepl {:mvn/version "0.8.3"}
djblue/portal {:mvn/version "0.6.4"}}}
λ cat src/user.clj
(ns user
(:require [portal.api :as p]))
(p/open)
(p/tap)
λ clojure -M -m nrepl.cmdline
nREPL server started on port 61861 on host localhost - <nrepl://localhost:61861>
thanks!
Or https://github.com/gfredericks/user.clj if you don't want to do it per-project.
(I would probably have a function in user.clj
that calls p/open
and p/tap
instead of calling them on the top level, but YMMV.)
agrees
I wish we could have cljc though 🙂
Looks like there's a ticket for that: https://clojure.atlassian.net/browse/CLJ-2240
Thanks
You can also add (.addShutdownHook (Runtime/getRuntime) (Thread. #(p/close)))
to user.clj for cleanup
@neo2551 You can also check out https://github.com/eraserhd/rep
This can also be accomplished with babashka. https://book.babashka.org/#_interacting_with_an_nrepl_server