Fork me on GitHub
David Pham11:12:11

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]))

位 clojure -M -m nrepl.cmdline
nREPL server started on port 61861 on host localhost - 

馃挴 3

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

David Pham11:12:23

I wish we could have cljc though 馃檪

鈽濓笍 3

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