Fork me on GitHub
#tools-deps
<
2019-05-17
>
sogaiu18:05:25

i have an alias for starting a socket repl in my ~/.clojure/deps.edn -- does anyone have a good way to get the port chosen to be somewhat random and then print that port number to stdout so i know where to connect to?

lilactown19:05:00

I don’t think you can parameterize over aliases like that, but you could write a small script around it perhaps?

Alex Miller (Clojure team)20:05:48

rather than relying on the startup params, you could just write a small .clj that programmatically chose a random port and started the server

👍 4
Alex Miller (Clojure team)20:05:55

and then have the alias run that

Alex Miller (Clojure team)20:05:58

with the same params you pass on the cmdline mostly

sogaiu20:05:33

thanks for the ideas, will consider

seancorfield22:05:16

As an example, here's what we do at work.

sogaiu00:05:05

thanks for the sample code!

seancorfield22:05:16

As an example, here's what we do at work.

seancorfield22:05:04

That also starts Cognitect's REBL if it's on the classpath. And it saves the Socket REPL port in a dot file for next time.

seancorfield22:05:15

(to sort of match what nREPL tools do)