nrepl

https://github.com/nrepl/nrepl || https://nrepl.org
2020-12-02T11:09:11.059700Z

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.

flowthing 2020-12-02T11:29:16.059800Z

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>

💯 1
2020-12-02T11:30:56.060Z

thanks!

flowthing 2020-12-02T11:31:01.060200Z

Or https://github.com/gfredericks/user.clj if you don't want to do it per-project.

flowthing 2020-12-02T11:32:05.060500Z

(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.)

2020-12-02T11:33:17.060700Z

agrees

2020-12-02T11:33:23.060900Z

I wish we could have cljc though 🙂

☝️ 1
flowthing 2020-12-02T11:35:28.061100Z

Looks like there's a ticket for that: https://clojure.atlassian.net/browse/CLJ-2240

2020-12-02T11:39:50.061300Z

Thanks

djblue 2020-12-02T20:04:34.061600Z

You can also add (.addShutdownHook (Runtime/getRuntime) (Thread. #(p/close))) to user.clj for cleanup

bozhidar 2020-12-02T20:50:51.062100Z

@neo2551 You can also check out https://github.com/eraserhd/rep

borkdude 2020-12-02T21:13:43.062600Z

This can also be accomplished with babashka. https://book.babashka.org/#_interacting_with_an_nrepl_server